The key advantage of late bound entity classes is that customer entities and attributes not avaliable at complie time can still be referenced by geneic Entity("") class, these custom object are checked at run time only.

The key difference between early and late binding involves type conversion. While early binding provides compile-time checking of all types so that no implicit casts occur, late binding checks types only when the object is created or an action is performed on the type. The Entity class requires types to be explicitly specified to prevent implicit casts.

The advantages to using early-bound entity classes is that all type references are checked at compile time. The compiled executable contains the code necessary to invoke the types’ properties, methods, and events.

SDK:

Early Bound

<optional namespace>.Account, <optional namespace>.Contact, etc.

The code generation tool (CrmSvcUtil) creates early-bound entity classes, derived from the Entity class, that you can use to access business data in Microsoft Dynamics CRM. These classes include one class for each entity in your installation, including custom entities.

Use this method when you want to have the compiler check type references at compile time. Also, attributes and relationships are included in the generated class, so they have IntelliSense support for entity, attribute, and relationship names. Using strong types is generally the preferred method and is used in the majority of samples in this SDK documentation.

There are some downsides to this approach:

Classes must be regenerated each time entities are customized to take advantage of schema changes.

Serialization costs increase as the entities are converted to late bound types during transmission over the network.

Use the Early Bound Entity Classes in Code

Create Early Bound Entity Classes with the Code Generation Tool (CrmSvcUtil.exe)

Late Bound

Microsoft.Xrm.Entity

The Entity class contains the logical name of an entity and a property-bag array of the entity’s attributes. This lets you use late binding so that you can work with types such as custom entities and custom attributes that were not present when your application was compiled.

Another benefit of this is that less serialization occurs as entity data is transmitted over a network, which means higher performance.

There are some downsides to this approach:

Types must be explicitly specified to prevent implicit casts.

It is harder to isolate the impact of changes to the schema because the names for resources, such as entities and attributes, are hardcoded.

Spelling mistakes while coding are easier to make because the attribute names are hardcoded strings.

Use the Late Bound Entity Class in Code

最新文章

  1. ABP框架 - 值对象
  2. [译]reset, checkout和revert
  3. Java的注解机制——Spring自动装配的实现原理
  4. java网络编程之TCP实例
  5. Struts2内建校验器(基于校验框架的文件校验)
  6. window.showModalDialog 子窗口和父窗口不兼容最新的谷歌
  7. 不熟悉的CSS样式
  8. QList 排序
  9. Fedora25和win10双系统安装及使问题汇总
  10. Chome——扩展程序,获取更多扩展程序报错
  11. java课程设计(个人)--五子棋
  12. What Are You Talking About
  13. 虚拟主机,VPS,云主机之间的区别?
  14. JAVA乐观锁、悲观锁实现
  15. 洛谷P2261 余数求和
  16. 为什么要使用mybaits
  17. rocketmq中的NettyRemotingClient类的简单分析
  18. const 全面理解
  19. CButton控件
  20. 【第十一课】Tomcat原理解析【转】

热门文章

  1. 浅谈 django Models中的跨表
  2. [转]HTTP协议通信原理
  3. MySQL 5.7.3.0 安装 全程截图
  4. New Concept English three (30)
  5. New Concept English three (35)
  6. Python爬虫----抓取豆瓣电影Top250
  7. HAWQ取代传统数仓实践(十)——维度表技术之杂项维度
  8. Wordpress在主题或者插件中自定义存储附件的方法
  9. better1【模式】Module模式
  10. I/O多路复用方案