D
D
Dmitry2016-04-30 00:20:35
ASP.NET
Dmitry, 2016-04-30 00:20:35

Entity Ftamework how to work with context?

Hello! How to properly work with the context in EF, create once at application start, or create for each request, and then delete the context? If there are any other better methods, please share? And another question, is it expensive to create a context in terms of performance?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2016-04-30
@yarosroman

Use DI, caching is used to speed up. Creating a context is not a costly task, because just an object is created, and fetching and connecting to the database occur directly when accessing entities.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question