Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HasManyIds does not reflect additions to HasMany relationship #75

Open
zeitlerc opened this issue Oct 31, 2017 · 1 comment
Open

HasManyIds does not reflect additions to HasMany relationship #75

zeitlerc opened this issue Oct 31, 2017 · 1 comment

Comments

@zeitlerc
Copy link
Collaborator

If an entity is added to a HasMany relationship collection, it should be added to the Ids in HasManyIds. That is currently not the case within the same session.

[Model]
public class Person
{
    [HasManyIds("pizzas")]
    public IEnumerable<Guid> PizzaIds { get; set; }
    [HasMany]
    public ICollection<Pizza> Pizzas { get; set; }
}

var moarPizza = session.Get<Pizza>(moarPizzaId);
person.Pizzas.Add(moarPizza);
await session.Update(person);
// FAILS in same session.  Succeeds in new session
Assert.True(person.PizzaIds.Contains(moarPizzaId));
@zeitlerc
Copy link
Collaborator Author

zeitlerc commented Nov 6, 2017

This is fixed by #77 if session.Update was called. If the Ids are accessed before session.Update is called, they will still return outdated information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant