贵州历任省委书记:eXpressApp Framework 之DC技术入门系列(1) - 瘦山鸿的I.T.生活 - 博客园

来源:百度文库 编辑:九乡新闻网 时间:2024/04/28 07:23:56

好久没有写博客了,一个是工作忙的原因,二一个就是自己这两年的生活方面发生了太多的事情,导致自己没有精力写,最近,随着Devexpress公司的ORM框架工具XAF v20011.1的即将发布,随XAF的一个新的技术----DomainComponent(下文简称DC)也将正式发布.

以前我们用XAF开发实体对象的时候,用的最多的就是DomainObject(下文简称DO),但是,我们在使用的过程中会发现,DO有明显的局限性,比如在拓展复用方面就很是不尽如人意,特别是DO不能脱离XAF运行,这给我们的实际开发带来了成本方面的困扰,而DC在这方面就做了非常大胆的尝试,下面我们来了解下DC技术.

在这系列文章中,我将全部尽量使用DC技术进行介绍其使用方面的入门知识,并将会以一个简单采购系统作为介绍切入点,用实例让大家感受下DC能给我带来怎样的震撼

注:更多的详细信息,大家可以访问Devexpress 的官方网站http://www.devexpress.com/去了解,官网可以下载到xaf的30天试用版本,声明:提供此信息只是为了方便感兴趣的同行,仅此而已.

本次我们先来了解什么是DC?看看官方是怎么定义的:

Domain Components technology is designed to simplify data management andreusability by providing a much more flexible and abstracted approach tobusiness object design. You can compose an application from reusable blocks,abstracted away from a particular persistence layer.

With Domain Components you define interfaces instead of regular businessobjects inherited from XPO classes. These interfaces will declare requiredproperties or data fields. The way this data is to be processed ( Domain Logic)is then defined by creating special classes that determine how interface membersbehave when an object is constructed, when properties are changed, etc. Actualbusiness classes are automatically implemented by XAF at runtime based on theprovided logic and interfaces. You can package interfaces and domain logic in anassembly, and use it as a domain library. If you then create a new XAFapplication, you can reference the domain library and reuse domain components.Since interfaces support multiple inheritance, required business objects can becombined into new domain components. With interfaces you can make your domainmodel independent of implementation.

Benefits of the Domain Components Technology

Domain Components Technology is not by any means a replacement for theregular business classes approach for definingdomain entities. The main advantage of the technology is the ability to createreusable domain libraries containing components that can be combined in any way.If you do not need the ability to create reusable components and combine them,most probably you will not need to use Domain Components. The following listdescribes the benefits of the Domain Components technology and should help youdecide whether or not the approach is right for your task.

  • You can create reusable domain libraries.

    Most likely, each new XAF application you develop is not unique. The most common objects, such as Person, Phone, Address, etc., are always used. The Business Class Library provides you with a set of classes that you will need most frequently. But implementing your own reusable library is not a simple task. With Domain Components you can easily package an assembly and reference it in your applications.

  • You can use multiple inheritance.

    Since Domain Components are represented by interfaces and not by classes, you can use multiple inheritance to combine several previously defined components into a new one. The new Domain Component will expose the properties of all its ancestors and utilize their Domain Logic. Of course you can add new properties and apply additional logic.

  • You do not need to inherit from Base Persistent Classes when implementing Domain Components.

    Each regular business class is derived from one of the Base Persistent Classes in XAF. The behavior of these classes differs. For instance, a base class can either expose an auto-generated primary key property of an integer or Guid type, or not. The choice of the base class is made once a class is implemented. With Domain Components, you can use a specific base class in each new scenario (see the ITypesInfo.AddEntityToGenerate method overload that takes the baseClass parameter). However, attributes applicable to regular business classes and their properties can also be used with Domain Components. And of course, an object implemented via Domain Components does not differ from an object implemented in a standard way from the end-user or application administrator point of view.

eXpressApp Framework 之DC技术入门系列(1) - 瘦山鸿的I.T.生活 - 博客园 直接调用内置数据源连接对话框(C#/VB.NET2005源码) - 瘦山鸿的I.T.生活 - 博客园 PHP下一代的五个Framework介绍_zhuzhu的技术博客 拉力赛车手的入门讲解之 赛车漂移技术入门 体验Managed Extensibility Framework精妙的设计 - 道法自然 - 博客园 C#线程系列讲座(5):同步技术之Monitor - 哈佛校训 - 博客园 I T 精英易得的九种病 点菜的“入门技术” 老徐的博客 ? Blog Archive ? .NET Framework 4与.NET Framework 4 Client Profile 的区别 金之钗的日志 - 网易博客#m=0&t=1&c=fks_08406708608008806... T+0、T+1、T+N技术和操作方法 腾讯soso技术专家系列之总经理孙良 - 腾讯soso团队博客 - CSDN博客 T+0、T+1、T+N(波段)技术和操作方法 - 谈股论金 - 创幻论坛 - 中国最好的股... I Can’t Change NET Framework 1 【转载】技术系列之 定时器 无人值守安装.Net Framework 3.5的批处理脚本1 集邮欣赏之编年邮票系列-2007-5 京剧生角(T)1 集邮欣赏之编年邮票系列-2005-1 乙酉年(T) 集邮欣赏之编年邮票系列-2006-1 丙戌年(T) 阳光生活随笔系列篇 - 阳光的日志 - 网易博客 老徐的博客 ? Blog Archive ? .NET Framework 4 类库开发的设计准则 Google 黑板报 - Google (谷歌)中国的博客网志,走近我们的产品、技术和文化: 浪潮之巅第一章 — 帝国的余辉(AT&T)(三) FLASH MX 2004视频教程快速入门系列 - 理睬的日志 - 网易博客