Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Prism WPF app that uses services to read data from either a web API or directly, via EF. I want to register the services into the Unity container, and am thinking having them singletons is a pretty good idea. There should only ever be one thread using any one service, as it's a desktop app with one user.

Is there anything against making them singletons? They are extremely lightweight, so memory footprint (for them) is no issue.

What I have tried:

Nothing, just asking for advice.
Posted
Updated 30-Jan-17 23:24pm

1 solution

As long as they don't store state in the class itself you should be ok, ie if methods only use variables local to the method.
 
Share this answer
 
Comments
Brady Kelly 31-Jan-17 6:35am    
Plus one or two dependencies injected by Unity.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900