Esempio n. 1
0
        public static void Main()
        {
            Mapper.Initialize(mapper =>
                              mapper.AddProfiles(
                                  typeof(CommandsToEvents),
                                  typeof(EventsToDomain)));

            MartenDocumentStore.BootMartenDocumentStore();

            MartenDocumentStore.Store.Advanced.Clean.CompletelyRemoveAll();

            var allSeeds = new ISeed[]
            {
                new Countries(),
                new People(),
                new Sites(),
                new Aircraft(),
                //new Speeds(),
                //new VerifyAndRejectSpeedClaims(),
                //new UpdateASite(),
                //new EditSpeeds(),
            };

            using (var session = MartenDocumentStore.Store.LightweightSession())
            {
                foreach (var seed in allSeeds)
                {
                    Console.WriteLine($"Running DB Seed {seed.GetType().Name}");
                    seed.Run(MartenDocumentStore.Store.LightweightSession());
                    session.SaveChanges();
                }

                Console.WriteLine($"Finished running DB Seed...");
            }
        }
Esempio n. 2
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var config    = GlobalConfiguration.Configuration;
            var container = StructuremapMvc.StructureMapDependencyScope.Container;

            config.DependencyResolver = new StructureMapDependencyResolver(container);

            MartenDocumentStore.BootMartenDocumentStore();

            AutoMapperMappings.BootAutoMapper();
        }