I was just wondering, whether there's any other way to fill "fields on related fields" for an entity without setting Prefetch path for corresponding related entity.
Nope. Fields on related Fields are used in conjungtion with PrefetchPaths.
Also seems like saving entity with "fields on related fields" is not saving related fields. Is there a work around I can make it work. I dont even mind a hack
A hack would be to handle the OnSaveEvent and perform the save of thise fields yourself.
Note: Fields On Related Fields should be used in a read-only manner. It's far easier, if you modify the fields of the coresponding related entity and Save the entire Graph at once.
Order order = new Order(20);
PrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.OrderEntity);
prefetchPath.Add(OrderEntity.PrefetchPathCustomer);
adapter.FetchEntity(order, null, prefetchPath);
order.SomeField = "xx";
order.Customer.AnotherField = "zz";
/* while you may have order.CustomerAnotherField mapped on Customer.AnotherField, you should use the origial field for modifying data */
adapter.SaveEntity(order, false, true); // the third param is for the recursive save.
That would be the easiest solution possible.