MVC - 17.OA项目

 

 

1.分层

MVC - 17.OA项目

 

2.项目依赖关系

MODEL

IDAL -> MODEL

DAL -> IDAL,MODEL,EntityFramewrok(注意和MODEL里的版本要一致),System.Data.Entity

IBLL -> IDAL,MODEL

BLL ->  IBLL,IDAL,MODEL,DI

Controller -> IBLL,MODEL,DI

Web -> Controller,MODEL

 

3.T4模版生成业务层和数据层接口

<#@template language="C#" debug="false" hostspecific="true"#>
<#@include file="EF.Utility.CS.ttinclude"#><#@
output extension=".cs"#>
<#

CodeGenerationTools code = new CodeGenerationTools(this);
MetadataLoader loader = new MetadataLoader(this);
CodeRegion region = new CodeRegion(this, 1);
MetadataTools ef = new MetadataTools(this);

string inputFile = @"..\MODEL\OuOA.edmx";

EdmItemCollection ItemCollection = loader.CreateEdmItemCollection(inputFile);
string namespaceName = code.VsNamespaceSuggestion();

EntityFrameworkTemplateFileManager fileManager = EntityFrameworkTemplateFileManager.Create(this);

#>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IDAL
{
<#

// Emit Entity Types
foreach (EntityType entity in ItemCollection.GetItems<EntityType>().OrderBy(e => e.Name))
{
    //fileManager.StartNewFile(entity.Name + "RepositoryExt.cs");
    //BeginNamespace(namespaceName, code);
    
#>
public partial interface I<#=entity.Name#>DAL : IBaseDAL<MODEL.<#=entity.Name#>>
    {
    }

<#}#>

}

MVC - 17.OA项目

 

4.为什么要用DI来解决

MVC - 17.OA项目

 

5.IDBSession存储属性

MVC - 17.OA项目

 

6.数据层仓储DBSession

MVC - 17.OA项目

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2021-10-22
  • 2022-03-05
  • 2021-11-01
  • 2022-12-23
  • 2022-02-21
猜你喜欢
  • 2022-12-23
  • 2021-10-14
  • 2021-06-20
  • 2021-08-02
  • 2022-01-13
  • 2021-09-13
相关资源
相似解决方案