Hi,
I have a code first Devforce BOS which has OData set up. I am accessing the data from an iOS device in the JSON format which works fine.
However I want the property names in the JSON to be slightly different from the property names I have written in .NET.
I read that I can add an attribute to each property and the output with reflect the name configured. See the following code:
[ProvideEntityAspect]
[IgnoreProperties(@"EntityAspect", @"AAAA_EntityAspectForSerialization")]
[DataServiceKey(@"Id")]
public class ProductCategory
{
DataMember(Name="id")]
public Guid Id { get; set; }
[Required, MaxLength(20)]
[DataMember(Name = "code")]
public string Code { get; set; }
[MaxLength(50)]
[DataMember(Name = "name")]
public string Name { get; set; }
[Required]
[DataMember(Name = "trackUnitsInStock")]
public bool TrackUnitsInStock { get; set; }
}
However, even with these attributes configured, the JSON is:
{"d" : ["Id": "d4ea92f5-9008-4e8f-b695-11967d87afd6", "Code": "01", "Name": "Test", "TrackUnitsInStock": true]}
The property names are still the capitalized .net properties.
Is there an attribute that DevForce will use so I can change the names of the properties in the JSON or AtomPub?
I really don't want to have to go through all my code and rename all the properties to match the iOS core data equivalent.
I know I have to do it with .net attributes anyway, but I would like the underlying database to have proper capitalized field names.
Thanks in advanced.
Chris