0
votes

It looks like breeze is failing to include some properties in the returned metadata from the server. I am using breeze.js on the client and breeze-EF on the server without further configuration. This is my object

[Table("COEP")]
public class COEP : DataObject
{
    public string ID { get; set; }

    [Required]
    public string COEMID { get; set; }

    [Required]
    public string COJPID { get; set; }

    [Required]
    public string CORGID { get; set; }

    [Required]
    public string CODPID { get; set; }

    [Required]
    public short? COEPISMAIN { get; set; }

    DateTime? STARTDATE { get; set; }

    DateTime? ENDDATE { get; set; }

    [JsonIgnore]
    public virtual COEM COEM { get; set; }
}

And here is part of the metadata returned from the server with the call: xxxController.GetMetadata() ( I just took the part concerning the object COEP)

{"name":"COEP","customannotation:ClrType":"StampDev.Pro.v3.server.EndPoints.Comp.Data.COEP, StampDev.Pro.v3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "key":{"propertyRef":{"name":"ID"}}, "property":[ {"name":"ID","type":"Edm.String","maxLength":"128","fixedLength":"false","unicode":"true","nullable":"false"}, {"name":"COEMID","type":"Edm.String","maxLength":"128","fixedLength":"false","unicode":"true","nullable":"false"}, {"name":"COJPID","type":"Edm.String","maxLength":"Max","fixedLength":"false","unicode":"true","nullable":"false"}, {"name":"CORGID","type":"Edm.String","maxLength":"Max","fixedLength":"false","unicode":"true","nullable":"false"}, {"name":"CODPID","type":"Edm.String","maxLength":"Max","fixedLength":"false","unicode":"true","nullable":"false"}, {"name":"COEPISMAIN","type":"Edm.Int16","nullable":"false"}] "navigationProperty":{"name":"COEM","relationship":"Self.COEM_COEP","fromRole":"COEM_COEP_Target","toRole":"COEM_COEP_Source"}}

You can clearly see that the properties "STARTDATE" and "ENDDATE" (nullable datetime) have not been included.

These properties are not marked with the [NotMapped] attribute. They should be included in the metadata. I cannot thing of what could go wrong here. These properties are fields present in the table in my MS SQL database.

The weird thing is that I have other objects with STARTDATE Datetime properties and they are properly returned in metadata. On more thing: the object "COEP" is the second level child in the master-child-child relationship, where COEP is a second level child. Any help, any hint to what could go wrong will be very much appreciated. Thanks

1

1 Answers

0
votes

You omitted the public access modifiers for STARTDATE and ENDDATE. Therefore, these properties are private by default, not mapped to the table, and not exposed in metadata. Easy thing to miss (as I discovered scratching my head for the last half hour).

Why is COEPISMAIN both [Required] and optional (short?)?