Hello, can you please explain me what is the significance of [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("activityid")]
in the following code?
[Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("activityid")]
public Microsoft.Xrm.Sdk.EntityReference ActivityId
{
get
{
return this.GetAttributeValue<Microsoft.Xrm.Sdk.EntityReference>("activityid");
}
set
{
this.OnPropertyChanging("ActivityId");
this.SetAttributeValue("activityid", value);
this.OnPropertyChanged("ActivityId");
}
}
I searched for this thing and I got many posts which gave me answer as the ones in square brackets are Attributes in C#. But, then attributes are related with methods. Over here, ActivityId
doesn't seem to be a method. So, how can [Microsoft.Xrm.Sdk.AttributeLogicalNameAttribute("activityid")]
act as an attribute?
Is it related to C#
or it has got something to do with CRM
?
The confusion comes from your statement about attributes only being valid on methods. Attributes can be valid on items specified in the AttributeTargets
enum:
http://msdn.microsoft.com/en-us/library/system.attributetargets.aspx
This then puts you back to the answer being "they are attributes". That attribute has simply been applied to a property.