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

Dynamics CRM early binding and late binding的更多相关文章

  1. java之多态(Polymorphic)、动态绑定(Dynamic Binding)、迟绑定(Late Binding)

    今天,我们来说说java面向对象最核心的东西,多态.通过多态可以使我们的程序可复用性达到极致,这就是我们为什么要学多态的原因. “多态”(Polymorphic)也叫“动态绑定”(Dynamic Bi ...

  2. Dynamics CRM Audit Performance Troubleshooting

    记一次Dynamics CRM Audit 查询失败的问题. 客户环境现象:由于业务逻辑需要使用RetrieveAuditDetailRequest API查询相关Record的详细更改信息.但查询过 ...

  3. Step-by-Step Guide to Portal Development for Microsoft Dynamics CRM - 摘自网络

    The Challenge Oftentimes in the world of Dynamics CRM, the need arises for non-CRM users to gain acc ...

  4. Dynamics CRM 2011 Web Service

    Data Services:   SOAP Endpoint REST Endpoint Capabilities Assign Records Retrieve Metadata Execute M ...

  5. Dynamics CRM 2015-超大Solution导入问题

    我们在将比较大的solution导入CRM的时候,经常会遇到超时的问题,这是因为CRM的本身的优化限制导致的,那么如何解决呢? 官方已经有了解决方案了. 在浏览完两种解决方法之后,我们要知道的是: 1 ...

  6. Dynamics CRM导出数据到Excel

    原创地址:http://www.cnblogs.com/jfzhu/p/4276212.html 转载请注明出处 Pivot Table是微软BI的一个重要工具,所以这里讲一下Dynamics CRM ...

  7. Step by step Dynamics CRM 2011升级到Dynamics CRM 2013

    原创地址:http://www.cnblogs.com/jfzhu/p/4018153.html 转载请注明出处 (一)检查Customizations 从2011升级到2013有一些legacy f ...

  8. Step by Step 创建一个新的Dynamics CRM Organization

    原创地址:http://www.cnblogs.com/jfzhu/p/4012833.html 转载请注明出处 前面演示过如何安装Dynamics CRM 2013,参见<Step by st ...

  9. Step by step Dynamics CRM 2013安装

    原创地址:http://www.cnblogs.com/jfzhu/p/4008391.html 转载请注明出处   SQL Server可以与CRM装在同一台计算机上,也可安装在不同的计算机上.演示 ...

随机推荐

  1. mysql学习笔记(window下简单使用+Navict)

    之前安装过mysql.最近刚好要重新翻出来看看 发现又忘记了那些命令.还是要百度.所以不如自己整理下 尽管网上有很多相关的介绍.当时想对的不如自己整理出来的舒服 首先是下载安装.网上有很多就不一一罗列 ...

  2. js中关于json常用的内容、js将数字保留两位小数

    没什么好说的  保存起来  以后有个地方找 var json=eval("[]") //json定义 var s={"id":"xxx",& ...

  3. Swagger实践和总结

    Swagger学习和实践 最近安装并使用了一下Swagger-ui.Swagger-editor和Swagger-codegen,感觉还不错. Swagger 是一个规范和完整的框架,用于生成.描述. ...

  4. Vue: webpack js basic structure

    vue webpack所用基础包: nom install vue vue-loader webpack webpack-cli webpack-dev-server vue-template-com ...

  5. H264的start code是什么?

    H.264起始码 在网络传输h264数据时,一个UDP包就是一个NALU,解码器可以很方便的检测出NAL分界和解码.但是如果编码数据存储为一个文件,原来的解码器将无法从数据流中分别出每个NAL的起始位 ...

  6. 5.linux目录结构介绍

    目录: 1.linux系统的目录结构特点?为何会形成这样的目录结构? 2.基本目录内容详解! 3.重要目录详解! 1.linux系统的目录结构特点? A.Linux系统的目录结构是一棵倒挂的大树,”/ ...

  7. (七)js函数一

    1.函数概念:函数是由事件驱动的或者当它被调用时执行的可重复使用的代码块. 语法:fuction hello(){         code...     } a)手动驱动: eg: hello(); ...

  8. LINUX命令—让人喜爱的find

    FIND命令的让人喜爱的地方在于其后面跟着的 –exec  可以执行其他linux命令 这点太让人高兴了,不过他的结尾要带一个特殊的结构 {} \: 说说实例:

  9. dynamic_caast操作符

    dynamic_caast操作符,将基类的指针或引用安全的转换为派生类的指针或引用. 原理: 将一个基类对象指针或引用抛到继承类指针,dynamic_cast会根据基类指针是否真正指向继承类指针来做相 ...

  10. 【mssql】SQL Server2012编程入门经典(第四版)(上) 读书笔记

    数据库用了很久了,但好多东西很容易忘记,这次头脑发热想起来读一遍书,做点笔记! 从第五章开始参考:<SQL Server 2005 编程入门经典>学习笔记 一.RDBMS基础:SQL Se ...