Hope it's okay to just reopen this thread.
The JSON we're getting out, now looks like this:
[{"_promotionProducts":null,"_fieldsData":[[null,null],[null,null],[null,null],[null,null], [null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null], [123456,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null]],"_fieldsFlags":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false, false,false,false,false,false,false,false,false,false,true,false,false,false,false,false, false,false,false,false,false,false,false,false],"_fieldsState":0,"_fieldsIsDirty": true,"_name":"ProductEntity","_isNew":true,"_validator":null,"_objectID": "02e45596-db12-4f65-9a99-4dfe3d86fef8","_concurrencyPredicateFactoryToUse":null, "_dataErrorInfoError":"","_dataErrorInfoErrorsPerField":null ,"_typeDefaultValueProvider":null,"_authorizerToUse":null ,"_auditorToUse":null,"_relatedEntitySyncInfos":null,"_field2RelatedEntity":null}]
Obviously, this is not what we need (for example: field names are not in there).
I expected the JSon to be more like this:
{"ProductNo":"123456","Description":"Some Product"}
I guess that is still related to the serialization process, right?
We're using the DNN Service Framework (which is built on top of WebAPI), so I don't have a config.cs but the place where this is handled, contains this code after the MapHttpRoute call:
var config = new HttpConfiguration();
var json = config.Formatters.JsonFormatter;
json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
json.SerializerSettings.ContractResolver = new DefaultContractResolver()
{
IgnoreSerializableInterface = true,
IgnoreSerializableAttribute = true
};
The ProductEntity class looks like this (including some of the decorated members):
// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
// __LLBLGENPRO_USER_CODE_REGION_END
/// <summary>Entity class which represents the entity 'Product'.<br/><br/></summary>
[Serializable]
[DataContract]
public partial class ProductEntity : CommonEntityBase
// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
// __LLBLGENPRO_USER_CODE_REGION_END
{
[DataMember]
public virtual Nullable<System.Int32> CategoryId
{
get { return (Nullable<System.Int32>)GetValue((int)ProductFieldIndex.CategoryId, false); }
set { SetValue((int)ProductFieldIndex.CategoryId, value); }
}
/// <summary> The CertificateDocument property of the Entity Product<br/><br/></summary>
/// <remarks>Mapped on table field: "Product"."CertificateDocument"<br/>
/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 2147483647<br/>
/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
[DataMember]
public virtual System.String CertificateDocument
{
get { return (System.String)GetValue((int)ProductFieldIndex.CertificateDocument, true); }
set { SetValue((int)ProductFieldIndex.CertificateDocument, value); }
}
/// <summary> The Created property of the Entity Product<br/><br/></summary>
/// <remarks>Mapped on table field: "Product"."Created"<br/>
/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 2147483647<br/>
/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
[DataMember]
public virtual System.String Created
{
get { return (System.String)GetValue((int)ProductFieldIndex.Created, true); }
set { SetValue((int)ProductFieldIndex.Created, value); }
}
Anything I'm doing wrong?
Hope you can help.
Greetz,
Stefan