abp-ConsoleProject


附上一个学习网站:C#高级知识点&(ABP框架理论学习高级篇)——白金版 - tkbSimplest - 博客园 (cnblogs.com)

1.引入ABP

2.添加自定义module,继承AbpModule

public class MyAbpModule : AbpModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }
}

3,添加自己的service,继承ITransientDependency

 //[Dependency(ServiceLifetime.Transient)]
    public class Service : ITransientDependency
    {
        public void Run()
        {
            Console.WriteLine("你好");
        }
    }

4.具体实现

 static void Main(string[] args)
        {
            using (var bootstrapper = AbpBootstrapper.Create())
            {
                bootstrapper.Initialize();

                var service = IocManager.Instance.Resolve();
                service.Run();
                Console.ReadKey();
            }
        }

相关分析,

01 AbpBootstrapper:

ABP