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..."); } }
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration) { services.AddSingleton(MartenDocumentStore.CreateDocumentStore(configuration.GetConnectionString("PricingServiceConnection"))); services.AddScoped <IDataStore, DocumentDbStore>(); services.AddConventionalServices(typeof(ServiceRegistration).Assembly); return(services); }
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(); }