ABP 支持模块化开发

第一步,在MVC项目 Application_Start开启支持模块化开发

需在Web项目下面新建PlugIns文件夹

AbpBootstrapper.PlugInSources.AddFolder(Server.MapPath("/PlugIns"));
MvcApplication.AbpBootstrapper.PlugInSources.AddToBuildManager();

第二步,在项目中新建PlugIns文件夹,名字随便,目的是将所有的模块项目放到该目录下面

新建模块项目

第三部,添加Abp相关文件,Abp版本最好和其他项目一直

在nuget分别添加 abp,abp.Web.Api 

第四步,初始化模块

在改项目下添加,PluginTestDeviceModule类

添加以下代码,

 [DependsOn(typeof(AbpWebApiModule))]
    public class PluginTestDeviceModule: AbpModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());

            Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder
                .ForAll<IApplicationService>(typeof(PluginTestDeviceModule).Assembly, "Device").Build();
        }
    }

  

到处完成相关代码配置。

猜你喜欢

转载自www.cnblogs.com/hack301/p/9957119.html
ABP
今日推荐