[Last Call] Learn how to a build a cloud-first strategyRegister Now


Creating a database context

Posted on 2011-05-11
Medium Priority
Last Modified: 2012-05-11
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?

Question by:newbieweb
  • 3
  • 2
LVL 96

Expert Comment

by:Bob Learned
ID: 35746725
"Database context" suggests that you are using something like Entity Framework, but that's just a guess...

Author Comment

ID: 35746802
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.


Author Comment

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

LVL 96

Accepted Solution

Bob Learned earned 2000 total points
ID: 35748117
I imagine that you have seen something like this:

Using the IRepository Pattern with LINQ to SQL

Author Closing Comment

ID: 35748185
That should keep me busy until I get more questions.


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question