Simplify common data access functions by using Entity Framework extens(blog.goranobradovic.com)

submitted by goranobradovicgoranobradovic(17) 7 months, 25 days ago

Simple project featuring usage of EntityFramework CodeFirst and overriding SaveChanges method of DBContext in order to keep record of changes on entities in database. There is a simple usage sample project and a test project with couple of test cases to confirm that everything is working.

4 comments |category: |Views: 122

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by dpetersondpeterson(4397) 7 months, 25 days ago +1

You've nailed it here, the repository pattern is not what we want. Entity Framework already implements the unit-of-work pattern via the context object, as you point out. Extending it there is the correct choice, rather than trying to mix and match the unit-of-work and repository patterns.

Reply

posted by vijaystvijayst(1311) 7 months, 24 days ago 0

I am bit confused by IEntityMap and JContext. Are these classes some kind of custom classes? Or is it part of a framework?

Reply

posted by goranobradovicgoranobradovic(17) replied to vijaystvijayst(1311), 7 months, 24 days ago +1

These are custom classes, but JContext inherits from DbContext, which is part of EntityFramework (4.1). You have full source code on github (link in article), and you can download it to see/use it.

Reply

posted by vijaystvijayst(1311) replied to goranobradovicgoranobradovic(17), 7 months, 24 days ago 0

Thanks. I will check the link.

Reply

information Login or create an account to comment on this story