Beispiel #1
0
 protected void Application_Start()
 {
     MapperConfig.Config();
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
        public void SyncOrder()
        {
            var startTime = DateTime.Now;

            MapperConfig.Config();
            dataSyncManager.SyncOrder(DateTime.Now);

            var ms = (DateTime.Now - startTime).TotalMilliseconds;

            System.Console.WriteLine(ms);
        }
        protected void Application_Start()
        {
            DirectorySetup();
            SetupContainer();

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            MapperConfig.Config();
        }
        protected override void OnStartup(StartupEventArgs e)
        {
            this.Startup += App_Startup;
            base.OnStartup(e);
            MapperConfig.Config();

            this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);

            //非UI线程未捕获异常处理事件(例如自己创建的一个子线程)
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            //Task线程内未捕获异常处理事件
            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
        }
Beispiel #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            MapperConfig.Config();
            SwaggerConfig.AddRegistration(app);

            app.UseHttpsRedirection();
            app.UseMvc();
        }
        public App()
        {
            InitializeComponent();

            if (MockDataService)
            {
                TypeLocator.Start();
                MainPage = new NavigationPage(new OnBoardingAnimationPage());
            }
            else
            {
                ListenNetworkChanges();
                if (!SQLiteDatabase.Shared.Initialized)
                {
                    SQLiteDatabase.Shared.Init();
                }

                DataService.TypeLocator.Start();
                MapperConfig.Config();
                GetUserInfo();
            }
        }
Beispiel #7
0
        public App()
        {
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjM5OTk5QDMxMzgyZTMxMmUzMEFnUXFRcnloZ1VyZDVHd2lETnhocmNTWjhWQU9OeDdhY0xMZC9kc0MxYkE9;MjQwMDAwQDMxMzgyZTMxMmUzMEFobERaU0IrWW93WURhSnczRzE4aHRncEswZWoydWJjUzFqQmhWaW5zemM9;MjQwMDAxQDMxMzgyZTMxMmUzMEJNTDkxZFFDNmN1anV3UW5tR0tMTnJIUk1uMnpMSHdqN20wQ3ZQWFV4UTg9;MjQwMDAyQDMxMzgyZTMxMmUzMEdzVnJiUnR0bWJEdmFLSWNEVWxZVWxtL2NnYjkrSzEwWGtiZENTR3BMVFU9;MjQwMDAzQDMxMzgyZTMxMmUzMG1ocnJyanRVMHlObW90Sy9kVklscDRjNlg4anZDViswRnQxOHFBamllR1E9;MjQwMDA0QDMxMzgyZTMxMmUzMG9yK2pXWlpQSVU0Z2M3d1pBMi83NmVOdUliRTFhQ0xGb04xYytCYW1EVFk9;MjQwMDA1QDMxMzgyZTMxMmUzMEgranBheFRNS0JHT0ZiLzQrTWZ2WlR5QktPeC9UL3gzbWJ2WDFQVmtaMm89;MjQwMDA2QDMxMzgyZTMxMmUzMGhteCtNM3NRN0FsczVvU3YwdzdUZHpPc1ExcXZwS21vMjlNLzVNVzBpVG89;MjQwMDA3QDMxMzgyZTMxMmUzMGV0QlZOckpwdkxOZmxBTkFQRFFPcDdLSi9sTHRIZGhIMW5IKzlVQW5OR3M9;NT8mJyc2IWhia31ifWN9Z2FoYmF8YGJ8ampqanNiYmlmamlmanMDHmg1ITI9ODw1PDY3JhM0PjI6P30wPD4=;MjQwMDA4QDMxMzgyZTMxMmUzMFc0aHlLSEFNZlJ5L3BDU2YwSERBaTdEZ3J6V25lN01rUmxNU2NjeldaSGM9");

            InitializeComponent();

            if (MockDataService)
            {
                TypeLocator.Start();
                MainPage = new NavigationPage(new LanguageSettings());
            }
            else
            {
                ListenNetworkChanges();
                if (!SQLiteDatabase.Shared.Initialized)
                {
                    SQLiteDatabase.Shared.Init();
                }

                DataService.TypeLocator.Start();
                Mapper = MapperConfig.Config();
                GetUserInfo();
            }
        }
Beispiel #8
0
 public BaseApiController()
 {
     _db     = new ApplicationDbContext();
     _mapper = MapperConfig.Config().CreateMapper();
 }
Beispiel #9
0
        public HomeControllerTest()
        {
            MapperConfig.Config();

            _controller = new HomeController();
        }
Beispiel #10
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     MapperConfig.Config();
 }
Beispiel #11
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // services.AddDbContext<ApplicationContext>(opts => opts.UseSqlServer(Configuration["ConnectionString:SimpleDB"]));

            services.AddDbContext <ApplicationDbContext>(options => options.UseLazyLoadingProxies().UseMySql(Configuration["ConnectionString:SimpleDB"], ServerVersion.AutoDetect(Configuration["ConnectionString:SimpleDB"])));

            services.AddDefaultIdentity <ApplicationUser>()
            .AddEntityFrameworkStores <ApplicationDbContext>()
            .AddDefaultTokenProviders();

            services.AddIdentityServer()
            .AddDeveloperSigningCredential()
            // this adds the config data from DB (clients, resources)
            .AddConfigurationStore(options =>
            {
                options.ConfigureDbContext = builder =>
                                             builder.UseMySql(Configuration["ConnectionString:SimpleDB"], ServerVersion.AutoDetect(Configuration["ConnectionString:SimpleDB"]),
                                                              sql => sql.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name));
            })
            // this adds the operational data from DB (codes, tokens, consents)
            .AddOperationalStore(options =>
            {
                options.ConfigureDbContext = builder =>
                                             builder.UseMySql(Configuration["ConnectionString:SimpleDB"], ServerVersion.AutoDetect(Configuration["ConnectionString:SimpleDB"]),
                                                              sql => sql.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name));

                // this enables automatic token cleanup. this is optional.
                options.EnableTokenCleanup   = true;
                options.TokenCleanupInterval = 30;
            }).AddAspNetIdentity <ApplicationUser>();


            services.AddAuthentication().AddIdentityServerJwt();

            DIConfig.AddDependencies(services);
            MapperConfig.Config(services, Configuration);



            services.AddMvc();
            services.AddControllers();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "WebAPICodeFirstSample", Version = "v1"
                });
                // To Enable authorization using Swagger (JWT)
                c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme()
                {
                    Name         = "Authorization",
                    Type         = SecuritySchemeType.ApiKey,
                    Scheme       = "Bearer",
                    BearerFormat = "JWT",
                    In           = ParameterLocation.Header,
                    Description  = "Enter 'Bearer' [space] and then your valid token in the text input below.\r\n\r\nExample: \"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\"",
                });
                c.AddSecurityRequirement(new OpenApiSecurityRequirement
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "Bearer"
                            }
                        },
                        new string[] {}
                    }
                });
            });
        }