I have CRM entity called C which has N:1 relationship with entity Account. Account has 1:N relationship with entity B
Problem Statement:
Create a new record for Entity C with update of existing Account(a) (Update in existing account(a) is : a already had two records b1 and b2 of type Entity B . I need to add third record b3 of type Entity B)
Following is my code
_context.Attach(c.relationshipNameWithAccount);
_context.UpdateObject(c.relationshipNameWithAccount);
_context.AddObject(c);
_context.SaveChanges();
This code is executing successfully.
It is Adding a new record in C(as expected) also updating fields in existing record a (as expected) but not adding b3 in existing account a(not expected).