Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I ecnountered a similar error. It turned out the bug was on my side. It seems you are setting up a connection table. Make sure your Models are properly configured with foreignKey Attribute (or fluent API). Why are you setting the ID yourself in the first place, should it not be like this and let breeze handle it? </p> <pre><code>newConexion.PalancaDestinoID(destino); &lt;--- newConexion.PalancaOrigenID(origen); &lt;--- newConexion.Activa(true); </code></pre> <p>The following works well:</p> <pre><code>createTeamUser = function (user, team, temporary) { var teamUserType = metadataStore.getEntityType("TeamUsers"); var newTeamUser = teamUserType.createEntity(); newTeamTemp = manager.addEntity(newTeamUser); newTeamUser.Team(team); newTeamUser.User(user); user.TeamUsers().push(newTeamTemp); team.TeamUsers().push(newTeamTemp); return newTeamTemp; }, </code></pre> <p>with this model:</p> <pre><code>public class TeamUsers { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long TeamUsersId { get; set; } public long TeamId { get; set; } [ForeignKey("TeamId")] [InverseProperty("TeamUsers")] public Team Team { get; set; } public long UserId { get; set; } [ForeignKey("UserId")] //&lt;---- Withour these attributes i got a null error too [InverseProperty("TeamUsers")] //&lt;---- public User User { get; set; } public bool Temporary { get; set; } //[Timestamp] //public byte[] TimeStamp { get; set; } } </code></pre> <p>with this field in the <code>User</code> model:</p> <pre><code> [InverseProperty("User")] public ICollection&lt;TeamUsers&gt; TeamUsers { get; set; } </code></pre> <p>Question: Julianyus adds the navigation properties before adding the new entity to the manager. He is setting attributes on the <code>detached</code> entity. As far as i understood the breeze-Docs everything done with the entity should be after adding it to the manager/cash. Is it safe to use the entity before adding to cache or not?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload