Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FieldMapRepoModule : Module
- {
- protected override void Load(ContainerBuilder builder)
- {
- var thisAssembly = typeof(FieldMapRepoModule).Assembly;
- builder.Register(c =>
- {
- var configuration = c.Resolve<IConfigurationRoot>();
- return configuration.GetSection("FieldMapRepoSettings").Get<Environment>();
- }).As<IEnvironment>();
- builder.Register(c =>
- {
- var configuration = c.Resolve<IConfigurationRoot>();
- var contextBuilder = new DbContextOptionsBuilder<GenesisDbContext>();
- var sqlConfiguration = configuration.GetSection("FieldMapRepoSettings").GetValue<string>("ConnectionString");
- contextBuilder.UseSqlServer(sqlConfiguration);
- var dbContextOptions = contextBuilder.Options;
- return dbContextOptions;
- }).SingleInstance();
- builder.RegisterType<GenesisDbContext>().InstancePerLifetimeScope();
- builder.RegisterAssemblyTypes(thisAssembly)
- .AsClosedTypesOf(typeof(Core.FieldValues.IRepository<>))
- .InstancePerLifetimeScope();
- }
- }
- JSON:
- {
- "GenesisHttpConfiguration": {
- "UserName": "xxxx",
- "Password": "xxxxx",
- "Host": "xxxxxxx",
- "AuthCookieUri": "xxxxxx",
- "AuthCookieName": "xxxxxx"
- },
- "APPINSIGHTS_INSTRUMENTATIONKEY": "xxxxxx",
- "StorageConfiguration": {
- "FiberJobs": "xxxxxx"
- },
- "FieldMapRepoSettings": {
- "ConnectionString": "xxxxxxx",
- "Environment": {
- "EnvironmentName": "DEV"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement