Satish

Satish

  • NA
  • 184
  • 99k

Object reference not set to an instance of an object

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