private static DynamicsDbContext GetApplicationDbContext() { var options = new DbContextOptionsBuilder <DynamicsDbContext>() .UseInMemoryDatabase(databaseName: "ApplicationDbContext") .Options; var db = new DynamicsDbContext(options); db.LockEntities.RemoveRange(db.LockEntities); db.SaveChanges(); db.LockEntities.AddRange(new List <LockEntity> { new LockEntity { EntityId = LockedCustomerId, EntityName = "Customer", IsLocked = true, LastLockTime = DateTime.UtcNow, LastUserId = LockedUser }, new LockEntity { EntityId = UnlockedCustomerId, EntityName = "Customer", IsLocked = false, LastLockTime = DateTime.UtcNow, LastUserId = LockedUser }, new LockEntity { EntityId = OldLockCustomerId, EntityName = "Customer", IsLocked = true, LastLockTime = DateTime.UtcNow.AddMinutes(-35), LastUserId = LockedUser } }); db.SaveChanges(); return(db); }
public LockEntityService(DynamicsDbContext db) { this.db = db; }
public GenericRepository(DynamicsDbContext dbContext) { this.dbContext = dbContext; }