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. angular-schema-form 自动表单生成

    基本用法 通过bower安装之后,将schemaForm模块载入到模块定义中,fuse中安装第三方包需要在app/core/core.module.js中声明. 然后在controller里面,将sc ...

  2. 浅谈 session 会话的原理

    先谈 cookie 网络传输基于的Http协议,是无状态的协议,即每次连接断开后再去连接,服务器是无法判断此次连接的客户端是谁. 如果每次数据传输都需要进行连接和断开,那造成的开销是很巨大的. 为了解 ...

  3. 接口测试工具---postman下载地址

    接口测试工具---postman下载地址: https://app.getpostman.com/app/download/win64?_ga=2.3555895.622696496.15081214 ...

  4. 【deep learning精华部分】稀疏自编码提取高阶特征、多层微调完全解释及代码逐行详解

    我们前面已经讲了如何训练稀疏自编码神经网络,当我们训练好这个神经网络后,当有新的样本输入到这个训练好的稀疏自编码器中后,那么隐藏层各单元的激活值组成的向量就可以代表(因为根据稀疏自编码,我们可以用来恢 ...

  5. 条款10:让operator=返回一个reference to *this

    例如对象x,y,z.要实现连锁赋值(假设operator=已经重载过了):x = y = z,那么operator=则必须返回一个*this. 注意这个条款不仅仅适合于operator=,对于oper ...

  6. UI- Layer的使用总结(附动画)

    #pargma mark - Layer 1. 设置当前视图的背景颜色 self.view.backgroundColor = [UIColor lightGrayColor]; 2. 创建一个视图, ...

  7. 【网络】<网络是怎样连接的>笔记

    [一] 浏览器 http://user:pwd@hosturl:port/dir/of/file 基本思路: 1.1 生成http请求信息 包含“对什么”“进行怎样的操作”两个方法.一般常用操作是GE ...

  8. Azure VM Scalable Sets -- 适用IAAS架构

    1. 选择Virtual Machine scale set2. 选择resource manager(或创建最新)3. 基本信息配置4. 配置scale的参数(可伸缩的balance模型):VM最小 ...

  9. jQuery 绑定事件总结

    目前已知有: $("..").bind("事件名",fn); $("parent").on("事件名","se ...

  10. beego数据输出

    beego数据输出   概览 直接输出字符串 模板数据输出 静态模板数据输出 动态模板数据输出 json格式数据输出 xml格式数据输出 jsonp调用 概览 直接输出字符串 通过beego.Cont ...