Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Creating a database context

I worked on a DDD project not long ago using the IRepository pattern. To save the addition of a new object, we'd called the Save() method of the POCO's IRepository object.

Last, we'd call Commit() on the database context.

I am having trouble putting all that together on my own project.

Could someone show me some sample code that associates an IRepository and a database context?

Thanks,
newbieweb
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

"Database context" suggests that you are using something like Entity Framework, but that's just a guess...
Avatar of curiouswebster

ASKER

It could be EF but does not need to be. Let's try this with EF.

Using Code First, I need to learn how to associate an instance of IRepository, associated with a POCO, with a database context. I say POCO, since there's not need to use a partial class, when it's Schema First.

newbieweb
" I say POCO, since there's NO need to use the partial class (generated by EF), AS when it's Schema First."

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That should keep me busy until I get more questions.

Thanks,
newbieweb