CrmCodeGenerator icon indicating copy to clipboard operation
CrmCodeGenerator copied to clipboard

Issue when attribute has same name as entity

Open xairrick opened this issue 7 years ago • 0 comments

mistake when generating classes. Below I will give an example of the work of the standard mechanism of the utility. [System.Runtime.Serialization.DataContractAttribute()] [Microsoft.Xrm.Sdk.Client.EntityLogicalNameAttribute("new_bankgroup")] [System.CodeDom.Compiler.GeneratedCodeAttribute("CrmSvcUtil", "8.0.1.7297")] public partial class new_BankGroup : Microsoft.Xrm.Sdk.Entity, System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged {

[Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("new_bankgroup")] public string new_BankGroup1 // correct { get { return this.GetAttributeValue("new_bankgroup"); } set { this.OnPropertyChanging("new_BankGroup1"); this.SetAttributeValue("new_bankgroup", value); this.OnPropertyChanged("new_BankGroup1"); } }

}

And you template.

[System.Runtime.Serialization.DataContractAttribute()] [Microsoft.Xrm.Sdk.Client.EntityLogicalNameAttribute("new_bankgroup")] public partial class new_BankGroup : Microsoft.Xrm.Sdk.Entity, System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged { [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("new_bankgroup")] public string new_BankGroup // error name property == name class { get { return this.GetAttributeValue("new_bankgroup"); } set { this.OnPropertyChanging("new_BankGroup"); this.SetAttributeValue("new_bankgroup", value); this.OnPropertyChanged("new_BankGroup"); } } }

xairrick avatar Jun 29 '18 12:06 xairrick