Suppose I have an ObjectContext of some sort with Order entities in it. So I can fetch orders from DB with:
MyContext.Orders.Select(...);
I can create new orders with:
Order.CreateOrder(...);
And add them to context:
MyContext.AddToOrders(newOrder);
But when I add new order into context it doesn’t show up anywhere. I can’t find it in MyContext.Orders, or anywhere else. Though If I invoke SaveChanges I’ll be stored in DB successfully.
This must be something very simple I’m missing out here.
MyContext.Orders will fetch the orders from the database.
Since your new
Orderobject hasn’t been added to the database, it won’t show up there.