Archive for August 2011

Lazy in C#, Lazy Loading, Eager Loading and Explicit Loading in Entity Framework

August 12, 2011

Lazy in C#;

In C# 4.0 a new type was introduced to support Lazy Loading. This helper type is great for types that require a long time to initialize.

Example:

new Car();

we can do

new Lazy();

This means that the CLR will load the type when a property is actually accessed.

About Lazy Loading, Eager Loading and Explicit Loading, here is a nice article:

http://weblogs.asp.net/dotnetstories/archive/2011/03/10/lazy-loading-eager-loading-explicit-loading-in-entity-framework-4.aspx

Entity Framework : Exception using OrderBy() in Dynamic LINQ

August 12, 2011

Using OrderBy(“ColumnName”)

Exception : ‘ColumnName’ could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly., near simple identifier!

The solution : Always, should not miss “it” to prefix there in all the Dynamic LINQ. Hence, OrderBy(“it.ColumnName”)