public IQueryable <EmployeeHistory> GetAll() { using (var context = new ElysiumContext()) { return(context.EmployeeHistory.AsQueryable()); } }
public EmployeeHistory GetById(Guid Id) { using (var context = new ElysiumContext()) { return(context.EmployeeHistory.First(x => x.Id == Id)); } }
public IQueryable <EmployeeSettings> GetAll() { using (var context = new ElysiumContext()) { return(context.EmployeeSettings.AsQueryable()); } }
public Employee GetById(Guid Id) { using (var context = new ElysiumContext()) { context.Configuration.LazyLoadingEnabled = false; return(context.Employee.First(x => x.Id == Id)); } }
public List <Employee> GetAll() { using (var context = new ElysiumContext()) { context.Configuration.LazyLoadingEnabled = false; return(context.Employee.ToList()); } }
public void Edit(Employee employee) { using (var context = new ElysiumContext()) { var dbEmployee = context.Employee.Find(employee.Id); context.Entry(dbEmployee).CurrentValues.SetValues(employee); context.SaveChanges(); } }
public void Add(Employee employee) { using (var context = new ElysiumContext()) { context.Employee.Add(employee); context.SaveChanges(); } }
public void Add(EmployeeHistory employeeHistory) { using (var context = new ElysiumContext()) { context.EmployeeHistory.Add(employeeHistory); context.SaveChanges(); } }
public void Add(EmployeeSettings employeeSettings) { using (var context = new ElysiumContext()) { context.EmployeeSettings.Add(employeeSettings); context.SaveChanges(); } }
public void Delete(Guid Id) { using (var context = new ElysiumContext()) { var employeeHistory = new EmployeeHistory() { Id = Id }; context.EmployeeHistory.Remove(employeeHistory); context.SaveChanges(); } }
public void Delete(Guid Id) { using (var context = new ElysiumContext()) { var employeeSettings = new EmployeeSettings() { Id = Id }; context.EmployeeSettings.Remove(employeeSettings); context.SaveChanges(); } }
public static void Main(string[] args) { string configFileName; if (args.Length >= 1) { configFileName = args[0]; } else { configFileName = "Load.json"; } Console.Write("loading configuration..."); var config = GetConfiguration(configFileName); Console.WriteLine("done!"); Console.Write("starting orleans..."); GrainClient.Initialize(GetOrleansConfiguration(config)); Console.WriteLine("done!"); try { Console.WriteLine($"loading dbc {nameof(MapDefinitionEntity)}"); new DbcLoader <IMapDefinition, MapDefinitionEntity>(config.Dbc.Path).LoadEntities(GrainClient.GrainFactory); Console.WriteLine($"loading dbc {nameof(RaceDefinitionEntity)}"); new DbcLoader <IRaceDefinition, RaceDefinitionEntity>(config.Dbc.Path).LoadEntities(GrainClient.GrainFactory); using (var context = new ElysiumContext(config.Sql.Address, config.Sql.Port, config.Sql.Schema, config.Sql.User, config.Sql.Password)) { Console.WriteLine($"loading sql {nameof(CharacterTemplateEntity)}"); new SqlLoader <ICharacterTemplate, CharacterTemplateEntity, PlayerCreateInfo>(context).LoadEntities(GrainClient.GrainFactory); Console.WriteLine($"loading sql {nameof(CreatureDefinitionEntity)}"); new SqlLoader <ICreatureDefinition, CreatureDefinitionEntity, CreatureTemplate>(context).LoadEntities(GrainClient.GrainFactory); } } finally { Console.Write("stopping orleans..."); GrainClient.Uninitialize(); Console.WriteLine("done!"); } if (Debugger.IsAttached) { Console.WriteLine("running with attached debugger; press enter to quit"); Console.ReadLine(); } }
public void Delete(Guid id) { using (var context = new ElysiumContext()) { var employee = new Employee() { Id = id }; var settings = new EmployeeSettings { Id = id }; context.Entry(settings).State = EntityState.Deleted; context.SaveChanges(); context.Employee.Attach(employee); context.Entry(employee).State = EntityState.Deleted; context.SaveChanges(); } }