Skip to content
This repository has been archived by the owner on Oct 9, 2021. It is now read-only.
/ DwFramework Public archive

基于Autofac的.Net Core微服务快速开发框架

License

Notifications You must be signed in to change notification settings

DwGoing/DwFramework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DwFramework

0x1 项目简介

基于Autofac的NetCore快速开发框架,这个框架旨在将服务注入简单化,把Autofac中常用的部分暴露出来,并融合了其他几个项目开发常用的组件。让整个开发的过程变得简单快速。当然,如果你有更复杂的业务需求,你可以直接引用Autofac来对本框架进行扩展。


0x2 组件列表

版本说明:NETVersion.ReleaseVersion.FixVersion

组件 说明 版本
DwFramework.Core 核心库
DwFramework.SqlSugar SqlSugar封装库
DwFramework.RabbitMQ RabbitMQ封装库
DwFramework.Quartz Quartz封装库
DwFramework.Web 网络库

0x3 简单示例

class Program
{
    static async Task Main(string[] args)
    {
        var host = new ServiceHost();
        host.ConfigureLogging(builder => builder.UserNLog());
        host.RegisterFromAssemblies();
        host.OnHostStarted += provider =>
        {
            foreach (var item in provider.GetServices<I>())
                Console.WriteLine(item.Do(5, 6));
        };
        await host.RunAsync();
    }
}

// 定义接口
public interface I
{
    int Do(int a, int b);
}

// 定义实现
[Registerable(typeof(I))]
public class A : I
{
    public A() { }

    public int Do(int a, int b)
    {
        return a + b;
    }
}

// 定义实现
[Registerable(typeof(I))]
public class B : I
{
    public B() { }

    public int Do(int a, int b)
    {
        return a * b;
    }
}

About

基于Autofac的.Net Core微服务快速开发框架

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages