• AbpZero后台模块化(1)


    AbpZero的精髓就在于多租户模块化加载,如果不做到这两种的话,就没必要使用这个框架。

    1、首先,我们得新建一个类库,用于存放我们写的业务代码。

          在类库下分别建立三个类文件:TestAppService ,ITestAppService ,TestModule,一下是对应代码:

          TestModule:

     1 using Abp.Modules;
     2 using Abp.Reflection.Extensions;
     3 using System;
     4 using System.Collections.Generic;
     5 using System.Text;
     7 
     8 namespace Test
     9 {
    10     public class TestModule : AbpModule
    11     {
    12 
    13         public override void PreInitialize()
    14         {
    15 
    16         }
    17 
    18         public override void Initialize()
    19         {
    20             IocManager.RegisterAssemblyByConvention(typeof(TestModule).GetAssembly());
    21         }
    22 
    23         public override void PostInitialize()
    24         {
    25             IocManager.Register<ITestAppService, TestAppService>();
    26             var test= IocManager.Resolve<ITestAppService>();
    27             test.Sender = IocManager.Resolve<ITestAppService>(typeof(TestAppService));
    28         }
    29     }
    30 }

    ITestAppService :

     1 using System.Threading.Tasks;
     4 namespace Test
     5 {
     6     public interface ITestAppService:IApplicationService
     7     {
    11         Task<string> GetTest();
    12     }
    13 }

    TestAppService :

    using Abp.Application.Services.Dto;
    using Abp.AutoMapper;
    using Abp.Domain.Repositories;
    using Abp.UI;
    using Microsoft.EntityFrameworkCore;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data;
    
    
    namespace Tensee.Banch.Attendance
    {
        public class AttendanceSchemeAppService : BanchAppServiceBase, IAttendanceSchemeAppService
        {
        pubilc async Task<string> GetTest(){
       return "这是模块化懒加载";
    }
    }
    }

    2、生成对应的Test.dll,拷贝这个dll到

    运行swagger就可以了。

  • 相关阅读:
    算法练习:求字符串的最长重复子串(Java实现)
    Oracle数据库中遇到的坑
    解决Oracle死锁问题步骤
    转:Spring Cache抽象详解
    Spring MVC测试框架详解——服务端测试
    转:SpringMVC中日期格式的转换
    freemarker判断是否为空
    jQuery Pagination分页插件
    Java链式方法
    mysql强制索引和禁止某个索引
  • 原文地址:https://www.cnblogs.com/LmuQuan/p/9155737.html
Copyright © 2020-2023  润新知