Entity Framework

Entity Framework 4 - When you can use Parameterized Constructors in Select

Skip to the bottom if want the quick answer ;-) Just a quick note on something I ran into today... I've taken to utilizing a View Model in which objects are created on a 1 to 1 basis to hold entities supplying data to the View/UI. As such, I modified my existing linq queries such that the View Model objects are created in the select portion of the query resulting in an enumerable list I can supply to the View. Below is an example: IQueryable<sessionfoo> fooquery = ((IEnumerable<sessionfoo... ......

Entity Framework 4 - Generating Entities based on Views

Just a quick post regarding a common issue and fix... When attempting to add a view as an entity to your model the EF generator may complain that it is unable to find or infer a primary key on your view. As a result, it will not add it to the model. The quick fix is to add the following to which ever column you wish to be the primary key within your view: ISNLL(TableA.ColumnA, -999) myPrimaryKeyColumnName Adding this will allow the EF generator to infer the primary key and add the view as an entity ......