I am using the Telerik DataAccess Fluent API Version: 2015.2.624.1 and SQLite
In my code I have one Customer model that can have many Account models associated. So I believe I've got the same basic setup as is found here:
Here is the mapping I use to create the association:
.HasAssociation(a => a.Customer)
.WithOpposite(c => c.CustomerAccounts)
.HasConstraint((a, c) => a.CustomerID == c.CustomerID);
And here is the code I have that saves a new customer and associated account:
using (FluentModel db = new FluentModel())
This results in two rows being inserted into the customer table. Seems customer gets inserted first then another duplicate customer inserts and is associated with the added account model/entity.
If I write it like this:
account.Customer = customer;
Then I get the expected results one customer, one account. But is there any way to get the first way to work without the duplicate entry?
Please let me know if you need more information or if I'm missing something here. Thanks!