コード例 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            AutoMapperConfig.Config();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Api.Catalog v1");
                c.SwaggerEndpoint("/swagger/v2/swagger.json", "Api.Catalog v2");
            });

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Default}/{action=Index}/{id?}"
                    );
            });
        }
コード例 #2
0
ファイル: Global.asax.cs プロジェクト: FoxWuGit/Fox.Proj
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     //Mapper
     AutoMapperConfig.Config();
 }
コード例 #3
0
        // ReSharper disable once AsyncConverter.AsyncMethodNamingHighlighting
        private static async Task Main()
        {
            var starshipService = new StarshipService(AutoMapperConfig.Config());

            System.Console.Write("Please type the distance in MGLU: [Default: 1000000] ");
            var input = System.Console.ReadLine();

            System.Console.WriteLine();

            if (!long.TryParse(input, out var distanceInMglu))
            {
                distanceInMglu = 1_000_000L;
            }

            System.Console.WriteLine("Calculating for the distance {0}.", distanceInMglu);

            var starships = await starshipService.ListStarshipsAndStopsAsync(distanceInMglu);

            foreach (var starship in starships)
            {
                System.Console.WriteLine("{0, -30}{1, 10}", starship.Name, starship.Stops);
            }

            System.Console.ReadLine();
        }
コード例 #4
0
ファイル: Global.asax.cs プロジェクト: gosusama/DBC
 protected void Application_Start()
 {
     ReportsControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration);
     GlobalConfiguration.Configure(WebApiConfig.Register);
     AutoMapperConfig.Config();
     log4net.Config.XmlConfigurator.Configure();
 }
コード例 #5
0
        public void Init()
        {
            var watch = new System.Diagnostics.Stopwatch();

            watch.Start();
            //设置配置加载
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            ConfigHelper.AppSettingsConfiguration = builder.Build();

            //设置数据库连接
            InitDatabase.Init();
            TypeMapper.InitializeAsync();

            //设定发起调用的基类
            Contanst.CallingEntryPointBasetype = typeof(TestBase);

            //配置automapper 的对象映射
            AutoMapperConfig.Config();

            this.MockIoc();

            watch.Stop();

            System.Diagnostics.Debug.WriteLine($"初始化耗时:{watch.ElapsedMilliseconds} ms");
        }
コード例 #6
0
 protected void Application_Start()
 {
     //Telerik
     ReportsControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration);
     GlobalConfiguration.Configure(WebApiConfig.Register);
     AutoMapperConfig.Config();
 }
コード例 #7
0
        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(Server.MapPath("~/Config/log4net.config")));

            // MEF配置
            MefConfig.RegisterMefDependencyResolver();

            AreaRegistration.RegisterAllAreas();

            // WebApi配置
            WebApiConfig.Register(GlobalConfiguration.Configuration);

            // 全局过滤器注册
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            // 路由注册
            RouteConfig.RegisterRoutes(RouteTable.Routes);


            //初始化映射
            MapConfig.Config();

            AutoMapperConfig.Config();

            FormattersConfig.Config();
        }
コード例 #8
0
ファイル: Global.asax.cs プロジェクト: isaikin/MVC-Sample
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     AutoMapperConfig.Config();
 }
コード例 #9
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     DbConfig.Initialize();
     AutoMapperConfig.Config(Assembly.GetExecutingAssembly());
 }
コード例 #10
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     AutoMapperConfig.Config();
     DefaultModelBinder.ResourceClassKey = "Resource";
 }
コード例 #11
0
        private void RegisterConteiner(IServiceCollection services)
        {
            services.AddHttpClient <ICopaFilmeBase, CopaFilmeBase>();

            services.AddScoped <ISorteioService, SorteioService>();

            services.AddScoped <UrlApi>(x => new UrlApi(x.GetService <IOptions <ApiLamb> >().Value.Url));

            services.AddScoped <IMapper>(_ => AutoMapperConfig.Config());
        }
コード例 #12
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            var virusTotalUrl    = Configuration.GetSection("VirusTotal:Url").Get <string>();
            var virusTotalApiKey = Configuration.GetSection("VirusTotal:ApiKey").Get <string>();

            Dependency.SetDependency(ref services, virusTotalUrl, virusTotalApiKey);
            services.AddSingleton(AutoMapperConfig.Config());
            ApiVersioning.SetVersion(ref services);
        }
コード例 #13
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     DIConfig.ConfigureUnityContainer();
     AutoMapperConfig.Config();
 }
コード例 #14
0
 protected void Application_Start()
 {
     DatabaseConfig.Config();
     ViewEnginesConfig.RegisterViewEngines();
     AutoMapperConfig.Config(Assembly.GetExecutingAssembly());
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
コード例 #15
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            var connectionString = Configuration.GetConnectionString("Default");

            Dependency.SetDependency(ref services, connectionString);
            services.AddSingleton(AutoMapperConfig.Config());

            ApiVersioning.SetVersion(ref services);
        }
コード例 #16
0
ファイル: Global.asax.cs プロジェクト: Todor13/BlogMVC
        protected void Application_Start()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion <ForumDbContext, Configuration>());

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            ViewEngineConfig.RegisterViewEngines(ViewEngines.Engines);
            AutoMapperConfig.Config(Assembly.GetExecutingAssembly());
        }
コード例 #17
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            var acountId   = Configuration.GetSection("MaxMind:AcountId").Get <int>();
            var licenseKey = Configuration.GetSection("MaxMind:LicenseKey").Get <string>();

            Dependency.SetDependency(ref services, acountId, licenseKey);
            services.AddSingleton(AutoMapperConfig.Config());

            ApiVersioning.SetVersion(ref services);
        }
コード例 #18
0
        protected void Application_Start()
        {
            AutofacConfig.Register();


            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            AutoMapperConfig.Config();
        }
コード例 #19
0
ファイル: Global.asax.cs プロジェクト: TeodSt/Trouvaille
        protected void Application_Start()
        {
            DbConfig.InitializeDatabase();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AutoMapperConfig.Config(Assembly.Load(ServerModelsAssembly));

            SqlCacheDependencyAdmin.EnableNotifications(ConnectionString);
            SqlCacheDependencyAdmin.EnableTableForNotifications(ConnectionString, CountriesTable);
        }
コード例 #20
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            var internalDomainCheckUrl           = Configuration.GetSection("InternalDomainCheckUrl").Get <string>();
            var internalVirusTotalIntegrationUrl = Configuration.GetSection("InternalVirusTotalIntegrationUrl").Get <string>();
            var internalOrderUrl = Configuration.GetSection("InternalOrderUrl").Get <string>();

            Dependency.SetDependency(ref services, internalDomainCheckUrl, internalOrderUrl, internalVirusTotalIntegrationUrl);
            services.AddSingleton(AutoMapperConfig.Config());

            ApiVersioning.SetVersion(ref services);
        }
コード例 #21
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            DbConfig.Intitalize();
            AutoMapperConfig.Config(Assembly.GetExecutingAssembly());

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());
        }
コード例 #22
0
ファイル: Global.asax.cs プロジェクト: estoyan/Noleggio
        protected void Application_Start()
        {
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine());
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AutoMapperConfig.Config(Assembly.GetAssembly(typeof(RentItemDtoModel)));

            Database.SetInitializer(new MigrateDatabaseToLatestVersion <NoleggioDbContext, Configuration>());
        }
コード例 #23
0
        protected void Application_Start()
        {
            AutofacConfig.ConfigureContainer();

            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en");
            //Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("uk-UA");

            AutoMapperConfig.Config();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
コード例 #24
0
ファイル: Global.asax.cs プロジェクト: ranchian/TaHuHuErp
        protected void Application_Start()
        {
            // Database.SetInitializer<BaseDbContext>(new ManagerInitializer());
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AutoMapperConfig.Config();
            MiniProfilerEF6.Initialize();

            //启用Job
            JobConfig.Start();
        }
コード例 #25
0
        static UTestConfigHelper()
        {
            var builder  = new ContainerBuilder();
            var baseType = typeof(IDependency);
            //builder.RegisterType<DataContext>().AsSelf().InstancePerLifetimeScope();
            //var assemblys = BuildManager.GetReferencedAssemblies().Cast<Assembly>();
            var assemblys = new Assembly[] { baseType.Assembly };

            builder.RegisterAssemblyTypes(assemblys.ToArray()).Where(t => baseType.IsAssignableFrom(t) && t != baseType).AsImplementedInterfaces().InstancePerLifetimeScope();
            //builder.RegisterType<DataContextProviderTest>().As<IDataContextProvider>().InstancePerLifetimeScope();
            _build = builder.Build();

            AutoMapperConfig.Config();
        }
コード例 #26
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );
            AutoMapperConfig.Config();
        }
コード例 #27
0
        protected void Application_Start()
        {
            UnityMvcActivator.Start();
            UnityWebApiActivator.Start();
            //UnityConfig.RegisterTypes();

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            //AutoMapper Regist
            AutoMapperConfig.Config();

            //移除預設API回應XML
            GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
        }
コード例 #28
0
        static void Main()
        {
            AutoMapperConfig.Config();

            if (File.Exists("MyDateBase.db"))
            {
                File.Delete("MyDateBase.db");
            }


            using (var db = new SqliteContext("MyDateBase.db"))
            {
                var position = new Position()
                {
                    Description = "Best Programmer"
                };

                db.Positions.Add(position);
                db.SaveChanges();

                var user = new User()
                {
                    Name       = "Kos",
                    Age        = 23,
                    PositionId = position.Id
                };
                db.Users.Add(user);
                db.SaveChanges();
            }

            using (var db = new SqliteContext("MyDateBase.db"))
            {
                var userUpdates = db.Users.ProjectTo <UserUpdate>().ToList();

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine();

                Console.WriteLine(string.Join(Environment.NewLine, userUpdates));
            }

            Console.ReadKey();
        }
コード例 #29
0
        /// <summary>
        /// 程序启动 加载入口配置
        /// </summary>
        /// <param name="configuration"></param>
        public Startup(IConfiguration configuration)
        {
            //配置注册gb2312编码
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            //保证配置的全局
            ConfigHelper.AppSettingsConfiguration = configuration;


            //设置AutoMapper
            AutoMapperConfig.Config();

            //设置mvc基础类型
            Contanst.CallingEntryPointBasetype = typeof(Controller);


            //设置数据库连接
            InitDatabase.Init(isAsync: true);
            //初始化 dapper的  基于Column标识的映射
            TypeMapper.InitializeAsync();
        }
コード例 #30
0
ファイル: TestBase.cs プロジェクト: jangocheng/FlyBirdYoYo
        public void Init()
        {
            //设置配置加载
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            ConfigHelper.AppSettingsConfiguration = builder.Build();

            //设置数据库连接
            InitDatabase.Init();
            TypeMapper.InitializeAsync();

            //设定发起调用的基类
            Contanst.CallingEntryPointBasetype = typeof(TestBase);

            //配置automapper 的对象映射
            AutoMapperConfig.Config();

            this.MockIoc();
        }