public static async Task Build <T>(this T entity, TimeKeeperContext context) { if (typeof(T) == typeof(Member)) { await BuildRelations(entity as Member, context); } if (typeof(T) == typeof(Project)) { await BuildRelations(entity as Project, context); } if (typeof(T) == typeof(Day)) { await BuildRelations(entity as Day, context); } if (typeof(T) == typeof(JobDetail)) { await BuildRelations(entity as JobDetail, context); } if (typeof(T) == typeof(Customer)) { await BuildRelations(entity as Customer, context); } if (typeof(T) == typeof(Employee)) { await BuildRelations(entity as Employee, context); } if (typeof(T) == typeof(User)) { BuildPassword(entity as User); } }
public override void InitializeDatabase(TimeKeeperContext context) { try { // ensure that old database instance can be dropped context.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction, $"ALTER DATABASE {context.Database.Connection.Database} SET SINGLE_USER WITH ROLLBACK IMMEDIATE"); } catch { // database does not exists - no problem ;o) } finally { base.InitializeDatabase(context); using (UnitOfWork unit = new UnitOfWork()) { addRoles(unit); addTeams(unit); addEmployees(unit); addEngagement(unit); addCustomer(unit); addProjects(unit); addDays(unit); addTasks(unit); } } }
public override void InitializeDatabase(TimeKeeperContext context) { try { context.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction, $"ALTER DATABASE {context.Database.Connection.Database} SET SINGLE_USER WITH ROLLBACK IMMEDIATE"); } catch { //database does not exist, excellent! } finally { base.InitializeDatabase(context); using (UnitOfWork unit = new UnitOfWork()) { AddRoles(unit); AddTeams(unit); AddCustomers(unit); AddProjects(unit); AddEmployees(unit); AddDays(unit); AddDetails(unit); AddEngagements(unit); } } }
private static async Task BuildRelations(Customer entity, TimeKeeperContext context) { if (entity.Image == null) { entity.Image = ""; } entity.Status = await context.CustomerStatuses.FindAsync(entity.Status.Id); }
private static async Task BuildRelations(Member entity, TimeKeeperContext context) { entity.Team = await context.Teams.FindAsync(entity.Team.Id); entity.Role = await context.Roles.FindAsync(entity.Role.Id); entity.Employee = await context.Employees.FindAsync(entity.Employee.Id); entity.Status = await context.MemberStatuses.FindAsync(entity.Status.Id); }
private static async Task BuildRelations(Employee entity, TimeKeeperContext context) { if (entity.Image == null) { entity.Image = ""; } entity.EndDate = new DateTime(1, 1, 1); entity.Position = await context.EmployeePositions.FindAsync(entity.Position.Id); entity.Status = await context.EmploymentStatuses.FindAsync(entity.Status.Id); }
private static async Task BuildRelations(Project entity, TimeKeeperContext context) { if (entity.Description == null) { entity.Description = ""; } entity.Team = await context.Teams.FindAsync(entity.Team.Id); entity.Customer = await context.Customers.FindAsync(entity.Customer.Id); entity.Status = await context.ProjectStatuses.FindAsync(entity.Status.Id); entity.Pricing = await context.PricingStatuses.FindAsync(entity.Pricing.Id); }
public override void InitializeDatabase(TimeKeeperContext context) { try { // ensure that old database instance can be dropped context.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction, $"ALTER DATABASE {context.Database.Connection.Database} SET SINGLE_USER WITH ROLLBACK IMMEDIATE"); } catch { // database does not exists - no problem ;o) } finally { base.InitializeDatabase(context); } }
public UnitOfWork(TimeKeeperContext context) { _context = context; }
public TeamsRepository(TimeKeeperContext context) : base(context) { }
public MembersRepository(TimeKeeperContext context) : base(context) { }
private static async Task BuildRelations(JobDetail entity, TimeKeeperContext context) { entity.Day = await context.Calendar.FindAsync(entity.Day.Id); entity.Project = await context.Projects.FindAsync(entity.Project.Id); }
public Repository(TimeKeeperContext context) { _context = context; _dbSet = _context.Set <Entity>(); }
public CalendarRepository(TimeKeeperContext context) : base(context) { }
private static async Task BuildRelations(Day entity, TimeKeeperContext context) { entity.Employee = await context.Employees.FindAsync(entity.Employee.Id); entity.DayType = await context.DayTypes.FindAsync(entity.DayType.Id); }
public RolesRepository(TimeKeeperContext context) : base(context) { }
public EmployeesRepository(TimeKeeperContext context) : base(context) { }
public AssignmentsRepository(TimeKeeperContext context) : base(context) { }
public ProjectsRepository(TimeKeeperContext context) : base(context) { }
public CustomersRepository(TimeKeeperContext context) : base(context) { }