public void Test1() { lock (this) { IocManager.Instance.RegisterIfNot <IMyFirstAppService, MyFirstAppService>(); DynamicApiControllerBuilder .ForAll <IApplicationService>(Assembly.GetExecutingAssembly(), "myapp") .Where(type => type == typeof(IMyFirstAppService)) .ForMethods(builder => { if (builder.Method.IsDefined(typeof(MyIgnoreApiAttribute))) { builder.DontCreate = true; } }) .Build(); var services = DynamicApiControllerManager.GetAll(); services.Count.ShouldBe(1); services[0].ServiceName.ShouldBe("myapp/myFirst"); services[0].Actions.Count.ShouldBe(1); services[0].Actions.ContainsKey("GetStr").ShouldBe(true); } }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(ABPDemoNoZeroApplicationModule).Assembly, "tasksystem") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(Assembly.GetAssembly(typeof(DogeDaycareApplicationModule)), "dogedaycare") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(PostAppService).Assembly, "blog") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(AdministracionActivosSobrantesApplicationModule).Assembly, "app") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(AbpProjectNameApplicationModule).Assembly, "app") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(MercadoCinotamApplicationModule).Assembly, "app") .Build(); Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer")); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(Assembly.GetAssembly(null), "app") .Build(); //DynamicApiControllerBuilder.For<IBookRepository>("getone/book").ForMethod("GetOneItem").WithVerb(HttpVerb.Get).Build(); }
private static void CreateWebApiProxiesForServices() { //TODO: must be able to exclude/include all methods option DynamicApiControllerBuilder .For <IFlowService>("workflow/flow") .Build(); DynamicApiControllerBuilder .For <IUserService>("workflow/user") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //Automatically creates Web API controllers for all application services of the application DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(BlueHrmApplicationModule).Assembly, "app") .Build(); Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer")); }
public void Test1() { IocManager.Instance.Register <IMyFirstAppService, MyFirstAppService>(); DynamicApiControllerBuilder .ForAll <IApplicationService>(Assembly.GetExecutingAssembly(), "myapp/ns1") .Build(); DynamicApiControllerManager.GetAll().Count.ShouldBe(1); DynamicApiControllerManager.FindOrNull("myapp/ns1/myFirst").ShouldNotBe(null); }
public override void Initialize() { //This code is used to register classes to dependency injection system for this assembly using conventions. IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //Creating dynamic Web Api Controllers for application services. //Thus, 'web api layer' is created automatically by ABP. DynamicApiControllerBuilder .ForAll <IApplicationService>(Assembly.GetAssembly(typeof(SimpleTaskSystemApplicationModule)), "tasksystem") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(AlphaProjectApplicationModule).Assembly, "app") .Build(); //通过上述设定,将所有的Application层中的Service公布为WebAPI,其访问路径如下 //{主机地址}/api/services/app/{Service类名称}/{方法名称} //http://localhost:61759/api/services/app/person/GetAllPersons Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer")); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(AbpSwaggerAppModule).Assembly, "app") .WithConventionalVerbs() .Build(); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(OtherAppModule).Assembly, "app") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //DynamicApiControllerBuilder // .ForAll<IApplicationService>(typeof(NotifyApplicationModule).Assembly, "app") // .Build(); DynamicApiControllerBuilder .For <IWebApiAppService>("notify/appservice") .WithConventionalVerbs() .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //动态创建webapiController与action DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(DoSoftApplicationModule).Assembly, "app") .Build(); var httpConfiguration = IocManager.Resolve <IEddoWebApiModuleConfiguration>().HttpConfiguration; //var cors = new EnableCorsAttribute("*", "*", "*"); //cors.SupportsCredentials = true; //httpConfiguration.EnableCors(cors); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //Automatically creates Web API controllers for all application services of the application DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(AbpZeroTemplateApplicationModule).Assembly, "app") .Build(); Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer")); ConfigureSwaggerUi(); //Remove this line to disable swagger UI. GlobalConfiguration.Configuration.EnableCors(new EnableCorsAttribute("*", "*", "*")); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); /* NOTE: ChenQP * ABP可以非常轻松地把Application Service的public方法发布成Web Api接口,可以供客户端通过ajax调用。 * SimpleTaskSystemApplicationModule这个程序集中所有继承了IApplicationService接口的类, * 都会自动创建相应的ApiController,其中的公开方法,就会转换成WebApi接口方法。 * * 可以通过http://xxx/api/services/tasksystem/Task/GetTasks这样的路由地址进行调用。 */ DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(SimpleTaskSystemApplicationModule).Assembly, "tasksystem") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //DynamicApiControllerBuilder // .ForAll<IApplicationService>(typeof(HlxBeApplicationModule).Assembly, "app") // .Build(); DynamicApiControllerBuilder .For <Application.Users.IUserAppService>("app/user") .Build(); DynamicApiControllerBuilder .For <Application.Sessions.ISessionAppService>("app/session") .Build(); DynamicApiControllerBuilder .For <Application.Roles.IRoleAppService>("app/role") .Build(); DynamicApiControllerBuilder .For <Application.MultiTenancy.ITenantAppService>("app/tenant") .Build(); #region Mobility Web Api DynamicApiControllerBuilder .For <Application.Mobility.Users.IUserAppService>("app/mobility/user") .Build(); DynamicApiControllerBuilder .For <Application.Mobility.Videos.IVideoAppService>("app/mobility/video") .Build(); #endregion #region MobilityH5 Web Api DynamicApiControllerBuilder .For <IProductAppService>("app/mobilityh5/product") .Build(); DynamicApiControllerBuilder .For <IShoppingCartAppService>("app/mobilityh5/shoppingcart") .Build(); #endregion Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer")); }
public override void Initialize() { IocManager.Resolve <ILogger>().Info("ClinAppsWebApiModule"); IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //DynamicApiControllerBuilder // .ForAll<IApplicationService>(typeof(IRoleAppService).Assembly, "appUsers") // .Where(type => type.Name.Contains("User")) // .Build(); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(IRoleAppService).Assembly, "clinApps") //.Where(type => !type.Name.Contains("User")) .Build(); Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer")); }
public override void Initialize(IAbpInitializationContext initializationContext) { base.Initialize(initializationContext); //This code is used to register classes to dependency injection system for this assembly using conventions. IocManager.Instance.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //Creating dynamic Web Api Controllers for application services. //Thus, 'web api layer' is created automatically by ABP. DynamicApiControllerBuilder .For <ITaskAppService>("tasksystem/task") .Build(); DynamicApiControllerBuilder .For <IPersonAppService>("tasksystem/person") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(PhoneBookApplicationModule).Assembly, "app") .Build(); Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer")); Configuration.Modules.AbpWebApi().HttpConfiguration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; //调用SwaggerUi ConfigureSwaggerUi(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app) { app.UseIISPlatformHandler(); app.UseFileServer(new FileServerOptions() { FileProvider = new PhysicalFileProvider(RuntimeContext.Current.Path.BaseDirectory), RequestPath = new PathString(""), EnableDirectoryBrowsing = false }); app.UsePerHttpRequestContainer(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{app}/{controller}/{action}", defaults: new { app = "base", controller = "common", action = "index" }); //新添加的路由配置 by jak routes.MapAppRoute( name: "app_one", template: "{app}/{controller?}", defaults: new { controllr = "index", action = "" }); routes.MapAppRoute( name: "app_two", template: "{app}/{controller}/{action}"); routes.MapAppRoute( name: "app_three", template: "{app}/{controller}/{action}/{action1}"); routes.MapAppRoute( name: "app_four", template: "{app}/{controller}/{action}/{action1}/{action2}/{id?}"); }); app.RegisterEntityFrameworkRepositoryContext(); app.RegisterAllModelCreators(); app.RegisterAllRepositories(); app.RegisterAllServices(); app.RegisterAllTranslateProviders(); DynamicApiControllerBuilder.For <ITestDataService>().WithApp("demo03").Build(); DynamicApiControllerBuilder.For <IArticleServices>().WithApp("Article").Build(); }
private static void CreateWebApiProxiesForServices() { //TODO: must be able to exclude/include all methods option DynamicApiControllerBuilder .For <ITaskeverUserAppService>("taskever/user") .Build(); DynamicApiControllerBuilder .For <ITaskAppService>("taskever/task") .Build(); DynamicApiControllerBuilder .For <IFriendshipAppService>("taskever/friendship") .Build(); DynamicApiControllerBuilder .For <IUserActivityAppService>("taskever/userActivity") .Build(); }
static void CreateWebApi(IocManager iocManager) { var assembly = Assembly.Load("Application"); var iocResolver = iocManager.Resolve <IIocResolver>(); var dynamicBuilder = new DynamicApiControllerBuilder(iocResolver); //Assembly.GetExecutingAssembly() dynamicBuilder .ForAll <IApplicationService>(assembly, "myapp") .ForMethods(builder => { //if (builder.Method.IsDefined(typeof(MyIgnoreApiAttribute))) //{ // builder.DontCreate = true; //} }) .WithConventionalVerbs() .WithProxyScripts(false) .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(SPMSApplicationModule).Assembly, "app") .Build(); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(ProcurementAppModule).Assembly, "procurement") .Build(); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(InventoryAppModule).Assembly, "inventory") .Build(); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(SalesAppModule).Assembly, "sales") .Build(); DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(ProductionAppModule).Assembly, "production") .Build(); }
public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); //Automatically creates Web API controllers for all application services of the application DynamicApiControllerBuilder .ForAll <IApplicationService>(typeof(AbpZeroTemplateApplicationModule).Assembly, "app") .Build(); Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer")); ConfigureSwaggerUi(); //Remove this line to disable swagger UI. //设置上传multipart/form-data Configuration.Modules.AbpWebApi().HttpConfiguration.Formatters.Add(new UploadMultipartMediaTypeFormatter <FileUploadInput>()); //Configuration.Modules.AbpWebApi().HttpConfiguration.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("multipart/form-data")); //cors var corsAttr = new EnableCorsAttribute("*", "*", "*", "*"); corsAttr.SupportsCredentials = true; Configuration.Modules.AbpWebApi().HttpConfiguration.EnableCors(corsAttr); }