1
Reply

Object reference not set to an instance of an object

Nagu

Nagu

May 12 2017 5:10 AM
169
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)