Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("AllowSpecificOrigin",
                                  config => config.WithOrigins("http://localhost:4200", "http://localhost:5000").AllowAnyMethod().AllowAnyHeader());
            });

            services.AddMvc(options =>
            {
                options.Filters.Add(typeof(ValidateModelAttribute));
            }).AddJsonOptions(options =>
            {
                options.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Local;
            });

            var appSettingsSection = Configuration.GetSection("AppSettings");

            services.Configure <AppSettings>(appSettingsSection);
            // configure jwt authentication

            services.AddDbContext <AppDbContext>(options => options.UseLazyLoadingProxies().UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));

            services.AddSwaggerDocumentation();
            InjectionModule.ConfigureServices(services);
            services.AddJwtAuthentication(Configuration);
        }
Exemplo n.º 2
0
        public static void Main()
        {
            InjectionModule.Init();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(InjectionModule.Container.GetInstance <DtmMainWindow>());
        }
Exemplo n.º 3
0
        public Startup(IConfiguration configuration)
        {
            Configuration    = configuration;
            _injectionModule = new InjectionModule();
            _mappingModule   = new MappingModule();

            Console.WriteLine("--- CONFIGURATION ---");
            Configuration.AsEnumerable().ToList().ForEach(i => Console.WriteLine("{0}", i));
            Console.WriteLine("--- CONFIGURATION ---");
        }