1

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.

Vitaliy Kurokhtin
  • 7,205
  • 1
  • 19
  • 18
  • I understand, that once Orders a fetched from DB they're cached inside ObjectContext. The question is: where does ObjectContext stored newly added entities? And is there a place where I can get a list of entities read from DB and ones I've just added. – Vitaliy Kurokhtin Sep 30 '09 at 03:29

2 Answers2

1

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
  • 868,454
  • 176
  • 1,908
  • 1,964
0

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

Vitaliy Kurokhtin
  • 7,205
  • 1
  • 19
  • 18