views:

36

answers:

2

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.

+1  A: 

MyContext.Orders will fetch the orders from the database.

Since your new Order object hasn't been added to the database, it won't show up there.

SLaks
A: 

Found this link. I guess I'll go that way.

Vitaliy Kurokhtin