Beispiel #1
0
        protected override void Seed(Com.Qualcomm.Qswat.Data.Context.EfContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.

            var seed = new DataSeeds(context);

            seed.SeedAll();
        }
Beispiel #2
0
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ConfigureServices();

            /// seed data
            var context    = ServiceProvider.GetRequiredService <ElectronicsStoreContext> ();
            var unitOfWork = ServiceProvider.GetRequiredService <IUnitOfWork> ();

            DataSeeds.Initialize(context, unitOfWork);
            context.SaveChanges();

            ///run forms
            var mainForm = ServiceProvider.GetRequiredService <MainForm> ();

            Application.Run(mainForm);
        }
Beispiel #3
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                var context  = services.GetRequiredService <ToDoListContext>();
                try
                {
                    DataSeeds.Initialize(context);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError("An error occured seeding database.", ex);
                }
            }

            host.Run();
        }
Beispiel #4
0
        public static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ///register services

            ConfigureServices();

            /// seed data
            var context = ServiceProvider.GetRequiredService <ManageToursContext>();

            DataSeeds.Initalize(context);
            context.SaveChanges();

            ///run forms
            var mainForm = ServiceProvider.GetRequiredService <MainForm>();

            Application.Run(mainForm);
        }