예제 #1
0
        private void Bootstrap()
        {
            Bootstrapper.Bootstrap(_container);
            MapperBootstrapper.Bootstrap(_cfg);

            Mapper.Initialize(_cfg);
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var config = new MapperConfigurationExpression();

            MapperBootstrapper.Bootstrap(config);
            Mapper.Initialize(config);

            services.AddDbContext <ApplicationContext>(options =>
                                                       options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            Bootstrapper.Bootstrap(services);

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "My API", Version = "v1"
                });
            });
        }
예제 #3
0
파일: App.xaml.cs 프로젝트: hx215267863/src
        //开始运行程序
        protected override void OnStartup(StartupEventArgs e)
        {
            if (!AppContext.Current.LoadLocalConfig())
            {
                MessageBox.Show("加载本地配置文件失败!", "提示");
            }
            if (AppContext.Current.LocalConfig.ClientType == LocalConfig.ClientTypeEnum.Live)
            {
                //获取路径
                this.StartupUri = new Uri("Live.xaml", UriKind.Relative);
            }

            base.OnStartup(e);
            LogUtil.Setup();

            MapperBootstrapper.Run();

            //全局捕获异常
            //this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(this.Current_DispatcherUnhandledException);
            //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException);
        }