Entity Framework

Entity Framework: Abstracting ObjectContext

Wither you are a TDD purest or not, if you are developing with Entity Framework and testability is important to you, then you have tried some workaround or applied some pattern to make testing possible in your project. When you have a class or method which depends on any external resource it is important to create some sort of abstraction in order to remove a dependency upon that resource so you can effectively test your code. The client I am currently working for has chosen to create a repository class which takes an ObjectContext argument in the constructor. The repository...

Entity Framework: How to Prevent Eager Loading

As we have been using Entity Framework on my current project I have found that it can be easy to kill eager loading on your queries. This can be a real problem if you are counting on it. I have been working on cross-cutting concerns up to this point, but because of my experience with Linq 2 SQL I was asked about some issues our team was having with eager loading. Namely, the Include() method, which is a method of the ObjectQuery type. If you've read any documentation on eager loading I'm sure you've read that using projections precludes the...

Entity Framework: Connection Strings

<add name="AdventureWorksEntities" connectionString="metadata=.\AdventureWorks.csdl|.\AdventureWorks.ssdl|.\AdventureWorks.msl; provider=System.Data.SqlClient;provider connection string='Data Source=localhost; Initial Catalog=AdventureWorks;Integrated Security=True;Connection Timeout=60; multipleactiveresultsets=true'" providerName="System.Data.EntityClient" /> According to MSDN, the above EntityClient connection string will search in the following locations for the specified csdl, ssdl and msl resource files: The calling assembly The referenced assemblies The assemblies in the bin directory of an applicationHowever, I have not found this to be...

Entity Framework POCO Adapter + System.Web.DynamicData == POCO Loco

This month I started with a new client. I'm excited because we'll be rewriting a legacy app using Entity Framework against an Oracle backend, and possibly ASP.NET MVC. The team is full of good, experinced developers, any of which could lead their own team. But as with all new technologies we're experiencing pains with early adoption. One of design goals is to be testible. We're not quite talking TDD here. None of us have been on a TDD project here so we're more just talking about trying to move in a direction we think will be beneficial. Additionally, the project specifications require us...

 

 

Copyright © Mark J. Miller