1
Answer

Object reference not set to an instance of an object

Nagu

Nagu

7y
184
1
public EFRepo(DbContext ctx)
{
this.DbContext = ctx;
this.DbConnection = ((ctx as System.Data.Entity.Infrastructure.IObjectContextAdapter).ObjectContext.Connection
as EntityConnection).StoreConnection;
this.DbSet = ctx.Set<TEntity>();
}
 
 
 In the above code 
(ctx as System.Data.Entity.Infrastructure.IObjectContextAdapter).ObjectContext.Connection
as EntityConnection
is getting null when i am changing EF 4 to 4.5
Answers (1)