// 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?}" ); }); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); //Mapper AutoMapperConfig.Config(); }
// 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(); }
protected void Application_Start() { ReportsControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration); GlobalConfiguration.Configure(WebApiConfig.Register); AutoMapperConfig.Config(); log4net.Config.XmlConfigurator.Configure(); }
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"); }
protected void Application_Start() { //Telerik ReportsControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration); GlobalConfiguration.Configure(WebApiConfig.Register); AutoMapperConfig.Config(); }
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(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfig.Config(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DbConfig.Initialize(); AutoMapperConfig.Config(Assembly.GetExecutingAssembly()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfig.Config(); DefaultModelBinder.ResourceClassKey = "Resource"; }
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()); }
// 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); }
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(); }
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); }
// 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); }
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()); }
// 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); }
protected void Application_Start() { AutofacConfig.Register(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfig.Config(); }
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); }
// 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); }
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()); }
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>()); }
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); }
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(); }
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(); }
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(); }
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(); }
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(); }
/// <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(); }
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(); }