May 2010 - Posts

1
Comments

Contains is smart enough to check for null by zhirani

Starting with Entity Framework 4.0 you can use Contains clause in your linq query to check if the column value matches any values in a given list. Suppose we have a model with Product and Category as shown below.   Let’s say we want to retrieve products...
1
Comments

How to share common fields between two entities that map to different tables by zhirani

The title is a mouthful so let me explain what we are trying to solve. Suppose we have two tables in the database that have common fields. When we import the tables into Entity Data Model, we want to create a base entity to contain the common fields and...
2
Comments

Entity Framework 4.0 Recipe book is officially released! by zhirani

I am very happy to announce that Entity Framework 4.0 Recipes book by Apress is officially released and is available for purchase from Amazon and other online book retailers. You can get your copy from Amazon at the address below. http://amzn.com/1430227036...
3
Comments

How to perform left join in linq to Entities by zhirani

To perform left outer join in a linq query, you would normally use DefaultIfEmpty operator. DefaultIfEmpty opreator basically gives you a default instance of an object when there is no related record found. In version 1 of Entity Framework, DefaultIfEmpty...
3
Comments

Stored Procedure returning entities and output parameter by zhirani

If you have a stored procedure that returns a collection of entities and also an output parameter, you must iterate through the resultset before the output value is available on the client. Accessing the output parameter value before looping through the...
2
Comments

Entities with complex Type properties cannot be returned from Stored Procedure by zhirani

Complex Types have been around since version 1 of Entity Framework. However the designer had no support for creating, modifying and returning entities with complex type. If you used complex type by editing the xml manually, you were not able to open the...
0
Comments

Filtering Entities with foreign key value by zhirani

Entity Framework 4.0 supports two two types of association, foreign key association and independent association. Foreign key association which is new allows you to modify/filter an entity using either navigation property or foreign key column exposed...
More Posts