Enterprise Solution 生成实体数据访问接口与实现类型 Code Smith 6.5 模板文件下载

数据库表定义为SalesOrder,用LLBL Gen Pro生成的实体定义是SalesOrderEntity,再用Code Smith生成的数据读写接口是ISalesOrderManager,最后是生成接口实现类型SalesOrderManager。

命名规范如下:

SalesOrder => SalesOrderEntity => ISalesOrderManager => SalesOrderManager

这个过程高度机械化,接口与实现类型生成完成,被框架调用即可完成数据读写。接口与实现类是万能的接口,可满足任意条件的查询与修改需求。

Interface.cst 接口文件:

<%@ CodeTemplate Language="C#" TargetLanguage="C#" Src="" Inherits="" Debug="True" Description="Template description here." %>
<%--<%@ Property Name="ProjectName" Type="System.String" Default="" Optional="False" Category="Project" Description="" %>
--%>
<%@ Property Name="AssemblyFile" Type="System.String" Default="" Optional="False" Category="Project" Description=""
 Editor="System.Windows.Forms.Design.FileNameEditor"%>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Project"  Description="" %>

<%@ Assembly Name="System.Data" %>
<%@ Import Namespace="System.Data" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>

<%@ Assembly Name="SD.LLBLGen.Pro.ORMSupportClasses.NET20" %>
<%@ Import Namespace="SD.LLBLGen.Pro.ORMSupportClasses" %>
<%@ Import Namespace="Foundation" %>
<%@ Assembly Name="Foundation.Common" %>

using System.Collections.Generic;
using System.Data;
using System.Text;
using SD.LLBLGen.Pro.ORMSupportClasses;

using <%=GetBusinessLogicProjectName%>;
using <%=GetBusinessLogicProjectName%>.FactoryClasses;
using <%=GetBusinessLogicProjectName%>.EntityClasses;
using <%=GetBusinessLogicProjectName%>.HelperClasses;
using <%=GetBusinessLogicProjectName%>.InterfaceClasses;
using <%=GetBusinessLogicProjectName%>.DatabaseSpecific;

<%-- using <%=ProjectName%>.Managers;
 --%>
<script runat="template">

public string GetEntityName
{
    get
    {
       string  entityName;
       entityName=EntityClassHelper.GetEntityName(SourceTable.Name,AssemblyFile);
       entityName=EntityClassHelper.TrimEntityName(entityName);
       return entityName;
    }
}

public string GetFullEntityName
{
    get
    {
      string  entityName;
      entityName=EntityClassHelper.GetEntityName(SourceTable.Name,AssemblyFile);
      return entityName;
    }
}

public string JudgeCommon(int i, int length)
{
    if(i==length) return "";
    else return ",";
}

public string TrimEntityLowercaseName
{
    get
    {
        string  entityName;
        entityName=EntityClassHelper.GetEntityName(SourceTable.Name,AssemblyFile);
        entityName=EntityClassHelper.TrimEntityName(entityName);
        entityName=EntityClassHelper.TrimEntityLowercaseName(entityName);
        return entityName;
    }
}

public string GetBusinessLogicProjectName
{
    get
    {
        string  prjojectName=EntityClassHelper.PrefixProjectName(AssemblyFile);
        return prjojectName;
    }
}

</script>
<%-- DataType get AnsiString
SystemType get System.String
 --%>
namespace <%=GetBusinessLogicProjectName%>.InterfaceClasses
{
    public interface I<%=GetEntityName%>Manager
    {
         <%=GetFullEntityName%> Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>);
         <%=GetFullEntityName%> Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>,IPrefetchPath2 prefetchPath);
         <%=GetFullEntityName%> Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>,IPrefetchPath2 prefetchPath,ExcludeIncludeFieldsList fieldList);

         EntityCollection Get<%=GetEntityName%>Collection(IRelationPredicateBucket filterBucket);
         EntityCollection Get<%=GetEntityName%>Collection(IRelationPredicateBucket filterBucket,ISortExpression sortExpression);
         EntityCollection Get<%=GetEntityName%>Collection(IRelationPredicateBucket filterBucket,ISortExpression sortExpression, IPrefetchPath2 prefetchPath);
         EntityCollection Get<%=GetEntityName%>Collection(IRelationPredicateBucket filterBucket, ISortExpression sortExpression, IPrefetchPath2 prefetchPath, ExcludeIncludeFieldsList fieldList);

         <%=GetFullEntityName%>  Save<%=GetEntityName%>(<%=GetFullEntityName%>  <%=TrimEntityLowercaseName%>);
         <%=GetFullEntityName%>  Save<%=GetEntityName%>(<%=GetFullEntityName%>  <%=TrimEntityLowercaseName%> ,EntityCollection entitiesToDelete);
         <%=GetFullEntityName%>  Save<%=GetEntityName%>(<%=GetFullEntityName%> <%=TrimEntityLowercaseName%>, EntityCollection entitiesToDelete, string seriesCode);

         void Delete<%=GetEntityName%>(<%=GetFullEntityName%>  <%=TrimEntityLowercaseName%>);

         bool Is<%=GetEntityName%>Exist(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>);
         bool Is<%=GetEntityName%>Exist(IRelationPredicateBucket filterBucket);
         int  Get<%=GetEntityName%>Count(IRelationPredicateBucket filterBucket);

         <%=GetFullEntityName%> Clone<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>);
         void Post<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>);
         void Post<%=GetEntityName%>(<%=GetFullEntityName%> <%=TrimEntityLowercaseName%>);
    }
}

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Manager.cst 接口实现文件:

<%@ CodeTemplate Language="C#"    TargetLanguage="C#" Src="" Inherits="" Debug="True" Description="Template description here." %>
<%--<%@ Property Name="ProjectName" Type="System.String" Default="" Optional="False" Category="Project" Description="????" %>
--%>
<%@ Property Name="AssemblyFile" Type="System.String" Default="" Optional="False" Category="Project" Description="" Editor="System.Windows.Forms.Design.FileNameEditor" %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Project"  Description="" %>

<%@ Assembly Name="System.Data" %>
<%@ Import Namespace="System.Data" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>

<%@ Assembly Name="SD.LLBLGen.Pro.ORMSupportClasses.NET20" %>
<%@ Import Namespace="SD.LLBLGen.Pro.ORMSupportClasses" %>
<%@ Import Namespace="Foundation" %>
<%@ Assembly Name="Foundation.Common" %>
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using SD.LLBLGen.Pro.ORMSupportClasses;
using <%=GetBusinessLogicProjectName%>;
using <%=GetBusinessLogicProjectName%>.FactoryClasses;
using <%=GetBusinessLogicProjectName%>.EntityClasses;
using <%=GetBusinessLogicProjectName%>.HelperClasses;
using <%=GetBusinessLogicProjectName%>.InterfaceClasses;
using <%=GetBusinessLogicProjectName%>.DatabaseSpecific;
using <%=GetBusinessLogicProjectName%>.Managers;
using Foundation.Common;
<%--using EntityCollection = <%=GetBusinessLogicProjectName%>.HelperClasses.EntityCollection;
--%>
<script runat="template">

public string GetEntityName
{
    get
    {
        string  entityName;
        //Debugger.Break();
        entityName=EntityClassHelper.GetEntityName(SourceTable.Name,AssemblyFile);
        entityName=EntityClassHelper.TrimEntityName(entityName);
        return entityName;
    }
}

public string GetFullEntityName
{
    get
    {
        string  entityName;
        //Debugger.Break();
        entityName=EntityClassHelper.GetEntityName(SourceTable.Name,AssemblyFile);
        return entityName;
    }
}

public string JudgeCommon(int i, int length)
{
    if(i==length) return "";
    else return ",";
}

public string GetBusinessLogicProjectName
{
    get
    {
       string  prjojectName=EntityClassHelper.PrefixProjectName(AssemblyFile);
       return prjojectName;
    }
}

</script>

namespace <%=GetBusinessLogicProjectName%>.Managers
{
       [RemoteService("<%=GetEntityName%>Manager")]
    public class <%=GetEntityName%>Manager :   Foundation.Common.ManagerBase, I<%=GetEntityName%>Manager
    {
        public <%=GetFullEntityName%> Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>)
        {
            return Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>,null);
        }

        public <%=GetFullEntityName%> Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>,IPrefetchPath2 prefetchPath)
        {
            return Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>,prefetchPath,null);
        }

        public <%=GetFullEntityName%> Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>,IPrefetchPath2 prefetchPath,ExcludeIncludeFieldsList fieldList)
        {
            <%=GetFullEntityName%>  _<%=GetEntityName%>=new <%=GetFullEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>);
            using (DataAccessAdapterBase adapter=GetCompanyDataAccessAdapter())
            {
                bool found=adapter.FetchEntity(_<%=GetEntityName%>, prefetchPath, null, fieldList);
                if (!found) throw new Foundation.Common.RecordNotFoundException("Invalid <%=GetEntityName%>");
            }
            return _<%=GetEntityName%>;
        }

        public EntityCollection Get<%=GetEntityName%>Collection(IRelationPredicateBucket filterBucket)
        {
            return   Get<%=GetEntityName%>Collection(filterBucket,null);
        }

        public EntityCollection Get<%=GetEntityName%>Collection(IRelationPredicateBucket filterBucket,ISortExpression sortExpression)
        {
            return   Get<%=GetEntityName%>Collection(filterBucket,sortExpression,null);
        }

        public EntityCollection Get<%=GetEntityName%>Collection(IRelationPredicateBucket filterBucket,ISortExpression sortExpression, IPrefetchPath2 prefetchPath)
        {
            return   Get<%=GetEntityName%>Collection(filterBucket,sortExpression,prefetchPath,null);
        }

        public EntityCollection Get<%=GetEntityName%>Collection(IRelationPredicateBucket filterBucket, ISortExpression sortExpression, IPrefetchPath2 prefetchPath, ExcludeIncludeFieldsList fieldList)
        {
            EntityCollection <%=GetEntityName%>Collection =new  EntityCollection(new  <%=GetEntityName%>EntityFactory());
            using (DataAccessAdapterBase adapter =GetCompanyDataAccessAdapter())
            {
                adapter.FetchEntityCollection(<%=GetEntityName%>Collection, filterBucket, 0,sortExpression, prefetchPath, fieldList);
            }
            return  <%=GetEntityName%>Collection ;
        }

        public <%=GetFullEntityName%>  Save<%=GetEntityName%>(<%=GetFullEntityName%>  <%=GetEntityName%>)
        {
            return Save<%=GetEntityName%>(<%=GetEntityName%>,null);
        }

        public <%=GetFullEntityName%>  Save<%=GetEntityName%>(<%=GetFullEntityName%>  <%=GetEntityName%> ,EntityCollection entitiesToDelete)
        {
            return Save<%=GetEntityName%>(<%=GetEntityName%>,entitiesToDelete,string.Empty);
        }        

        public <%=GetFullEntityName%>  Save<%=GetEntityName%>(<%=GetFullEntityName%> <%=GetEntityName%>, EntityCollection entitiesToDelete, string seriesCode)
        {
            using (DataAccessAdapterBase adapter =GetCompanyDataAccessAdapter())
            {
                try
                {
                    adapter.StartTransaction(IsolationLevel.ReadCommitted, "Save<%=GetEntityName%>");
                    adapter.SaveEntity(<%=GetEntityName%>, true, false);
                    adapter.Commit();
                }
                catch
                {
                    adapter.Rollback();
                    throw;
                }
            }
            return <%=GetEntityName%>;
        }

        public void Delete<%=GetEntityName%>(<%=GetFullEntityName%>  <%=GetEntityName%>)
        {
            using (DataAccessAdapterBase adapter =GetCompanyDataAccessAdapter())
            {
                if (!adapter.IsEntityExist<<%=GetFullEntityName%>>(<%=GetEntityName%>))
                return;

            try
            {
                adapter.StartTransaction(IsolationLevel.ReadCommitted, "Delete<%=GetEntityName%>");
                adapter.DeleteEntity(<%=GetEntityName%>);
                adapter.Commit();
            }
            catch
            {
                adapter.Rollback();
                throw;
            }
            }
        }        

        public bool Is<%=GetEntityName%>Exist(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>)
        {
            RelationPredicateBucket filterBucket = new RelationPredicateBucket();
            <% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %>
            filterBucket.PredicateExpression.Add(<%=GetEntityName%>Fields.<%=EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%>==<%=EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%>);
            <% } %>
            return Is<%=GetEntityName%>Exist(filterBucket);
        }

        public bool Is<%=GetEntityName%>Exist(IRelationPredicateBucket filterBucket)
        {
            return (Get<%=GetEntityName%>Count(filterBucket) > 0);
        }

        public int Get<%=GetEntityName%>Count(IRelationPredicateBucket filterBucket)
        {
            using (DataAccessAdapterBase adapter =GetCompanyDataAccessAdapter())
            {
                return adapter.GetDbCount<<%=GetFullEntityName%>>(filterBucket);
            }
        }

        public <%=GetFullEntityName%> Clone<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>)
        {
            <%=GetFullEntityName%>   source = this.Get<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>);
            <%=GetFullEntityName%>   _<%=GetEntityName%> = (<%=GetFullEntityName%>)CloneEntity(source);
            <%-- //try to remove all primary key
            //currency.Ccy = string.Empty;
            //currency.CreatedBy = Shared.CurrentUser.UserId;
            //currency.CreatedDate = DateTime.Now;
            //currency.RevisedBy = Shared.CurrentUser.UserId;
            //currency.RevisedDate = DateTime.Now;   --%>
            return _<%=GetEntityName%>;
        }

        public void Post<%=GetEntityName%>(<% for (int i = 0; i < SourceTable.PrimaryKey.MemberColumns.Count; i++) { %><%=SourceTable.PrimaryKey.MemberColumns[i].SystemType %> <%= EntityClassHelper.TrimFieldName(SourceTable.PrimaryKey.MemberColumns[i].Name)%><%=JudgeCommon(i,SourceTable.PrimaryKey.MemberColumns.Count-1)%><% } %>)
        {
            return;
        }
        public void Post<%=GetEntityName%>(<%=GetFullEntityName%> <%=GetEntityName%>)
        {
            return;
        }
    }
}

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

时间: 2024-11-08 21:53:25

Enterprise Solution 生成实体数据访问接口与实现类型 Code Smith 6.5 模板文件下载的相关文章

根据数据中的表生成实体和mapper接口及映射文件

1.创建一个Java工程,工程结构为 2.需要的jar包 链接:http://pan.baidu.com/s/1gd2jNDh 密码:pyux 3.GeneratorSqlmap public class GeneratorSqlmap { public void generator() throws Exception{ List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File

Android中使用系统提供API数据访问接口操作数据库

数据的增加 1.创建一个SQLite数据的帮助类 SQLiteDatabase db = helper.getWritableDatabase(); 2.创建一个类似map集合的类ContentValues,用来存储键值对 ContentValues values = new ContentValues(); 3.把需要增加的数据存放进去 values.put("name", name); values.put("number", number); 4.执行系统提供

Enterprise Solution 3.1 企业应用开发框架 .NET ERP/CRM/MIS 开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms

行业:基于数据库的制造行业管理软件,包含ERP.MRP.CRM.MIS.MES等企业管理软件 数据库平台:SQL Server 2005或以上 系统架构:C/S 开发技术 序号 领域 技术 1 数据库 SQL Server 2008 R2 2 程序语言 C# .NET 4 3 数据访问 LLBL Gen Pro 3.1 https://www.llblgen.com/ 4 界面 Windows Forms  http://www.infragistics.com/ 5 数据通讯 .NET Rem

Enterprise Solution 管理软件开发框架流程实战

1 定义模块和功能 执行系统功能(SAUTSF),在系统主文件(System Master File SAMF)模块中增加功能SAMFEM,Employee Master. 给有权限的用户组分配功能SAMFEM的权限,包含新增,删除,修改,打印,过帐权限,这是功能权限. 如果需要增加字段权限,比如可以编辑员工薪资字段,应该修改用户表(User)增加权限字段. 2 定义导航菜单 把增加的功能放置到合适的功能菜单中,菜单项的位置根据需要而定.比如员工主文件,可以放置到主档定义中,还可以放置一份到人事

Enterprise Solution 客户化二次开发

详细介绍Enterprise Solution 二次开发的流程步骤,主要包括数据输入窗体(Entry Form),查询(Query/Enquiry),报表(Report)三个重要的二次开发项目. 数据输入窗体开发 Entry Form 当涉及到字段的增加或增加数据库表时,开发新功能界面有以下几个主要步骤. 1  修改数据库增加表或字段,用LLBL Gen 生成新的实体映射类型定义文件. LLBL Gen 可检测到字段的变化,增加字段或减少字段可自动更新实体映射定义文件.需要设定参数选项,如下图所

系统架构师-基础到企业应用架构-数据访问层

一.上章回顾 上篇我们简单讲述了服务层架构模式中的几种,并且讲解了服务层的作用及相关的设计规范,其实我们应该知道,在业务逻辑层中使用领域模型中使用服务层才 能发挥出最大的优势,如果说我们在业务逻辑层还是使用非领域模型的模式话,服务层的作用仅体现在解耦作用.其实在业务逻辑层采用领域模型时,我们前面说的持 久化透明的技术,其实我们可以通过服务层来做,我们在服务层中处理领域对象信息的持久化操作.当然本篇可能不会深入讨论持久化透明的具体实现,后面会单独开 篇来讲述,我们先来回顾下上篇讲解的内容:  上图

解析大型.NET ERP系统数据访问 对象关系映射框架LLBL Gen Pro

LLBL Gen Pro是一个为.NET开发人员设计的的对象关系映射(ORM)框架,与NHibernate,Entity Framework等框架一样,通过实体与数据表的映射,实现关系数据库持久化. 1  LLBL Gen Pro 入门  LLBL Gen Pro Basic 打开LLBL Gen Pro程序,在右边的数据库浏览器(Catelog Explorer)中根结点右键选择从关系数据库创建关系模型( Add Relational Model Data from a Database),然

企业级应用框架(二)三层架构之数据访问层的封装与抽象

接上一篇我们来对数据访问层进行封装与抽象.在上一篇我们知道,要解除BLL对DAL的依赖,我们就必须抽象出DAL层的接口,同时基于DAL的数据访问技术很多,如EF,ADO.NET,LINQ TO SQL,因此,我们的数据访问层必须对这些技术提供相应的支持.所以今天我们要做的事情有两件,第一,定义我们的数据访问层接口:第二,屏蔽各类数据库访问技术的差异,提供统一的数据库访问模型.举个例子,我们只需要修改一下我们的配置文件,就能够把ADO.NET的实现方式,改变成EF的实现方式.好下面搭建我们的三层构

ADO.NET编程之美----数据访问方式(面向连接与面向无连接)

最近,在学习ADO.NET时,其中提到了数据访问方式:面向连接与面向无连接.于是,百度了一下,发现并没有很好的资料,然而,在学校图书馆中发现一本好书(<ASP.NET MVC5 网站开发之美>,当然,我不是做广告的,只因它确实还可以),里面关于二者之间的区别及原理讲得很清楚,下面我们就进入主题.今天心情不错.... 我们都知道ADO.NET提供了对数据库或外部数据源的数据访问接口,它本身实现了面向连接与面向无连接的数据访问方式.面向连接是以数据库连接为基础的,在打开数据库连接后,将数据访问指令