Using an EF DbContext and repository with SolidServices

Feb 4, 2013 at 1:34 PM
Edited Feb 4, 2013 at 1:35 PM
I have integrated an EF DbContext into this project so as to actually store and retrieve data from a database rather than the random generator. Here is a link to the project.

In doing this, I'm wondering if the bootstrapper in my WCF service and the BusinessLayer are correct. At first, I was not using SimpleInjector.Integration.Wcf and just registering the DatabaseFactory and UnitOfWork with .RegisterSingle. However, when running the client app I would perform two queries, then an update. The update calls .SaveChanges() on the context and at that point with RegisterSingle I would always have 3 entities being tracked in the context (2 from the first 2 queries, and 1 from the new entity addition).

To resolve this, I loaded the WCF integration package and now use .RegisterPerWcfOperation for the DatabaseFactory, UnitOfWork, and the one CountryRepository in the project (my only entity right now is a Country). Now when I call .SaveChanges after the queries and entity addition, I see only the one newly added entity in the context's tracker. This seems correct but if anyone can have a look at the project and let me know if the bootstrapper and general project structure seems correct it would be much appreciated. Again here is the link. Thanks.