Here is an example of the scenario.
Customer entity.
Orders entity.
Customer has Orders IEntityCollection.
A recursive save is needed. It is not possible use the recommended method below.
CustomerEntity customer = new Customer();
....fill object members....
......................................
......................................
OrderEntity order = new OrdersEntity();
....fill object members....
......................................
......................................
Customer.Orders.Add(order)
....save customer entity........
It will not be possible to do this as the primary entity and the FK relation will not be known until runtime. The question is - is it possible to get an entity collection member variable through specifying the name of the collection you require. I don't want to use reflection due to performance. I have thought of a possible solution to this - changing the generated code so each entity has a dictionary<string, entityCollection> of all the related entities. This can then return the desired entity collection. I do not really want to change the templates so is there any other way of achieving this. I dont want to go through the arrayList that is returned from method GetMemberEntityCollections and check the name of each of the entity collections either as this is long winded.
So something like this is desired
string entityName //set somewhere else
string relatedEntityName //set somewhere else
IEntity2 primaryEntity = new EntityFactory.CreateInstance(entityName);
..............fill member variables.........
.......................................................
IEntity2 relatedEntity = new EntityFactory.CreateInstance(entityName);
..............fill member variables.........
.......................................................
primaryEntity.GetRelatedEntityCollection(relatedEntityName).Add(relatedEntity);
save primaryEntity
Thanks in advance