WebAPI项目框架仓储模式+导入SqlSuag

 

参考:https://www.cnblogs.com/leon1128/p/18280611

//DI框架Autofac
public void ConfigureContainer(ContainerBuilder builder)
{
    string basePath = AppContext.BaseDirectory;
    string service = Path.Combine(basePath, "MES.Service.dll");
    string repository = Path.Combine(basePath, "MES.Repository.dll");

    builder.RegisterAssemblyTypes(Assembly.LoadFrom(service))
                .AsImplementedInterfaces()
                .InstancePerDependency();

    builder.RegisterAssemblyTypes(Assembly.LoadFrom(repository))
            .AsImplementedInterfaces()
            .InstancePerDependency();

}

  

简单方式,参考:https://www.object-c.cn/4714

 

https://developer.aliyun.com/article/1575370

posted @ 2025-07-26 17:31  microsoft-zhcn  阅读(5)  评论(0)    收藏  举报