Example #1
0
        public static void Initialize(string rootSection)
        {
            var config = new ConfigurationBuilder()
                         .SetBasePath(Directory.GetCurrentDirectory())
                         .AddJsonFile("appsettings.json")
                         .Build();

            var @root = config.GetSection(rootSection);

            foreach (var section in @root.GetChildren())
            {
                var name          = section.Key;
                var configuration = new TyperConfigurarion(section);

                if (name.ToLower().Equals("domain"))
                {
                    DomainConfiguration = configuration;
                }
                else
                {
                    ReferencesConfigurations.Add(section.Key, configuration);
                    ListedReferenceTypes[section.Key] = new Dictionary <string, Type>();
                }
            }
        }
Example #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSettings(Configuration);
            TyperConfigurarion.Initialize();
            MongoConfiguration.Initialize();
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
            services.AddHttpContextAccessor();
            services.AddDIConfiguration();
            services.AddAutoMapper(typeof(AutoMapperProfile));

            NativeInjectorBootStrapper.RegisterServices(services);
        }