this is my User Model:
public User{
... (no navigation Property to modeltype)
}
The following model is inspired from DocCode OrderDetails->Product where only OrderDetail has a Foreign Key to the Product.
For this config i get an error message from breeze: “Bad nav properties” for Users SB and TL but not for MA.
public modeltype{
public DateTime? ClosedBySB { get; set; }
public long? SBId { get; set; }
[ForeignKey("SBId")]
public User SB { get; set; }
public DateTime? ClosedByTL { get; set; }
public long? TLId { get; set; }
[ForeignKey("TLId")]
public User TL { get; set; }
public DateTime? ClosedByMA { get; set; }
public long? MAId { get; set; }
[ForeignKey("MAId")]
public User MA { get; set; }
....
}
while this works:
public modeltype{
public DateTime? ClosedBySB { get; set; }
//public long? SBId { get; set; }
//[ForeignKey("SBId")]
//public User SB { get; set; }
public DateTime? ClosedByTL { get; set; }
//public long? TLId { get; set; }
//[ForeignKey("TLId")]
//public User TL { get; set; }
public DateTime? ClosedByMA { get; set; }
public long? MAId { get; set; }
[ForeignKey("MAId")]
public User MA { get; set; }
....
}
I think this should work?
No additional Fluent Api Configuration is made.
Thanks for any help.
I had same problem when model contained 2+ properties with same Type (1-to-1 relation). I have to deep in logic of breeze work with associations to solve this problem. It seems that breeze analyzes each of them and removes from temp array, if current association have both ends. Otherwise breeze shows ‘bad nav properties’ error. In case of several 1-to-1 properties with same type breeze removes one end of all this 1-to-1 relations, except first property, and show error. Try to change this strings in “addToIncompleteMap” function in breeze.js:
to