SchemaName instead of "LogicalName"

Sep 25, 2012 at 1:16 PM
Edited Sep 25, 2012 at 2:48 PM

Hi, 

first of all thank you for this tool! 

Now my question: 

In your provided template you are using the logical-name of the attribute. I like to use the schema-name (to construct REST-Queries and the REST-API only supports the camel-case variante). 

The following template will not work:

 

foreach(var attribute in entity.Fields)	{#>
	this.<#=attribute.Attribute.SchemaName#> = null;
<#}#>

 

And by looking at the source-code only the following properties are avilable:

 

[Serializable]
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class CrmPropertyAttribute : Attribute
{
     public string LogicalName { get; set; }
     public bool IsLookup { get; set; }
     public bool IsEntityReferenceHelper { get; set; }
}

 

Is there a way to generate the schema-names? 

 

Regards,

 

Daniel

Coordinator
Sep 26, 2012 at 3:47 AM

Hi Daniel, the REST endpoint schema names are PascalCased and arn't the schemanames, you can try using attribute.DisplayName instead which will give you a PascalCased name which will work with the REST endpoint.

PS, I'll add a work item to include the schema name as a property for the next release :)