I can set an EntityReference on an entity without having to load the relevent entity as follows:
this.CategoryReference.EntityKey = new EntityKey("MyEntities.CategorySet", "Id", 12);
So I can set the Category for the entity I'm dealing with to whatever category has id 12 without having to hit the database.
But is there a way to do this or something similar on an EntityCollection? So if I now have multiple categories instead of just one, I want to now do something like the following, though it doesn't work:
// stand-in category
var categoryStandIn = new Category { EntityKey = new EntityKey("MyEntities.CategorySet", "Id", 12) }
this.Categories.Add(categoryStandIn);