Try this:
var context = new YourDbContext();
var adapter = (IObjectContextAdapter)context;
var objectContext = adapter.ObjectContext;
More Related Contents:
- Code-first vs Model/Database-first [closed]
- Unique key with EF code first
- What effect(s) can the virtual keyword have in Entity Framework 4.1 POCO Code First?
- Ignoring a class property in Entity Framework 4.1 Code First
- How Should I Declare Foreign Key Relationships Using Code First Entity Framework (4.1) in MVC3?
- Entity Framework code first. Find primary key
- Should I enable or disable dynamic proxies with entity framework 4.1 and MVC3?
- EF Code First: How to get random rows
- How do I detach objects in Entity Framework Code First?
- Overriding SaveChanges and setting ModifiedDate, but how do I set ModifiedBy?
- EF Code First – how to set identity seed?
- Order navigation properties when using Include and/or Select methods with EF 4.1 Code-First?
- Entity framework code-first null foreign key
- How to configure many to many relationship using entity framework fluent API
- How to map table splitting in EF Code First?
- Composite Key with EF 4.1 Code First
- How do you ensure Cascade Delete is enabled on a table relationship in EF Code first?
- Navigation Property without Declaring Foreign Key
- How do I define a database view using Entity Framework 4 Code-First?
- How to implement Yii2 Modal Dialog on Gridview view and update button?
- An error occurred while saving entities that do not expose foreign key properties for their relationships
- Entity Framework Database.SetInitializer simply not working
- Entity Framework Code First : Setting up One-To-One foreign key association using Annotations
- Enums with EF code-first – standard method to seeding DB and then using?
- Set database collation in Entity Framework Code-First Initializer
- Foreign keys in entity framework 4.1
- Model First with DbContext, Fails to initialize new DataBase
- Integration Testing Entity Framework code first with in-memory database
- How to set Custom height for Widget in GridView in Flutter?
- Getting exact error type in from DbValidationException