• Dynamics CRM early binding and late binding


    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

  • 相关阅读:
    DRF之url注册器组件
    序列化组件的使用及接口设计和优化
    Django 内置字段
    Django 的 ModelForm组件
    Django组件 中间件
    csrf
    django使用redis做缓存
    微信消息推送
    自定制serilazry字段
    小知识,大智慧(restframework 拾忆)
  • 原文地址:https://www.cnblogs.com/LeoTang/p/3209095.html
Copyright © 2020-2023  润新知