问题
After reading this SO question, I noticed that the link in the question made a reference to Microsoft.Xrm.Client.CodeGeneration.CodeCustomization,Microsoft.Xrm.Client.CodeGeneration
.
What advantages it has over the standard code gen? According to LameCoder it changes all the entities to inherit from Microsoft.Xrm.Client.CrmEntity
rather than `Microsoft.Xrm.Sdk.Entity. What changes does that make and what other changes are created?
回答1:
Here is the best site I could currently find on what it does:
- CrmSvcUtil & OrganizationServiceContext enhancements such as lazy loading
- Simplified Connection Management with Connection Dialog UI
- Client Side caching extensions
- Utility Extension functions for common tasks to speed up client development
- Organization Service Message utility functions to make it easy to call common messages such as BulkDelete, Add Member to Team etc.
- Objects to support the Microsoft.Xrm.Portal extensions
The only real downside I can see to inheriting from CrmEntity is that it requires the Microsoft.Xrm.Client dll to either be Gac'd on the server, or IL Mergered into the Entities dll.
Besides that one downside, here are the features I see it adding:
- Moves INotifyPropertyChanging and INotifyPropertyChanged into the base class, making resulting code smaller
- Defines additional class Attributes
System.Data.Services.Common.DataServiceKeyAttribute
System.Data.Services.IgnorePropertiesAttribute
(I'm assuming this one sends less data over the wire?)- Microsoft.Xrm.Client.Metadata.EntityAttribute (I believe this is used to support LazyLoading
- Option Sets properties are changed to nullable ints
- Money properties are now nullable decimals
- Setting a property value to the value it already is, will not trigger a property changing/changed event
- SetPrimaryIdAttributeValue results in smaller code.
来源:https://stackoverflow.com/questions/21270081/what-changes-does-referencing-codegeneration-codecustomization-make-to-the-early