static void Main(string[] args) { var tph = new TPHContext(); tph.Computers.Add(new Laptop() { Price = 1000, Description = "Standard Laptop", Weight = 3 }); tph.SaveChanges(); var tpt = new TPTContext(); tpt.Computers.Add(new Laptop() { Price = 1000, Description = "LightWeight Laptop", Weight = 3 }); tpt.SaveChanges(); var tpc = new TPCContext(); tpc.Computers.Add(new Laptop() { Price = 1000, Description = "LightWeight Laptop", Weight = 3 }); tpc.SaveChanges(); }
public void SetupTPT() { Console.WriteLine("Setting up database..."); using var context = new TPTContext(); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); context.SeedData(RowsPerEntityType); Console.WriteLine("Setup complete."); }
static void Main(string[] args) { using (var dbContext = new TPTContext("Data Source=.;Initial Catalog=TablePerTypeExampleDb2;Integrated Security=True")) { var bussinesService = new BussinesService(dbContext); XmlConfigurator.Configure(); var logger = LogManager.GetLogger("SampleTextLogger"); var loggerService = new LoggerService(logger); var isContinue = true; Task.Run(() => { while (isContinue) { RunEmitation(bussinesService, loggerService); Thread.Sleep(1000); } }); Console.ReadKey(); isContinue = false; var shareholders = bussinesService.GetShareholdersWithZeroBalance(); if (shareholders.Count() < 1) { Console.WriteLine("No shareholders with zero balance"); } else { foreach (var shareholder in shareholders) { Console.WriteLine($"id: {shareholder.Id}| balance: 0.00"); } } } Console.WriteLine("Table Per Type Done"); Console.ReadLine(); }
public static List <Root> TPT() { using var context = new TPTContext(); return(context.Roots.ToList()); }