In ASP.NET MVC, where is the "place for best practice" (folder) to place the Entity-Framework DataContext class?

I saw several projects with Entity Framework DataContext classes in the Models folder, but since this is not really a model, it is not.

Currently, my DataContext (along with the IDatabaseInitializer class) lives in the root of my project, but it hurts me too.

Is there a general / best practice for this, or should I just leave them in the root or in the Data folder or something like that?

+5
source share
6 answers

Perhaps it , . .

/ - .

EF ( ), - -, .

+3

. "", , .

+4

, , VS Solutions 3 :

  • ( MVC)
  • ( -, POCO)
  • ( , EF)
+3

, , MVC , MVC 3 , ... EM...

+3

Just my thoughts about it; for any classes related to the Entity Framework, such as the DataContext class or the base class, we put them in the DataFramework folder. As in theory, while they extend EntityFramework in this context, there is no reason why they cannot redistribute another database infrastructure such as nHibernate.

+1
source

All Articles