Can I see new added Entity before calling SaveChanges method

Yampolka
Yampolka used Ask the Experts™
on
I have Table Orders
I should allow user to add new Order , fill out it first and then Save Changes to to Database
I am working in EF5

how to I insert Entity  in  Entity Context before calling SaveChanges method?
Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Retired
Distinguished Expert 2017
Commented:
You can do something like this.

DcContextInstanceName.EntityTableName.Add(newlyCreatedEntity);

db.Orders.Add(newOrder);

Where db is the instance of the DbContext Orders is the entity class that maps to the database and newOrder is an instance of the Order table entity.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial