Generate DAL Layer from database (repository pattern)
How 开发者_如何学JAVAto generate DAL layer from already created database, based on repository pattern? Possible?
Sure, just use the Visual Studio designers to drag and drop database tables. You might also consider abstracting the operations with your entities behind interfaces in order to weaken the coupling between the consumers of those repositories and the specific implementation.
There are several resources on how to abstract the access to your data store using the repository pattern, but so far this is the most comprehensive article I've ever seen.
For creating repositories you can use a NuGet package I created, supply a namespace to your models and it will generate Repository and UnitOfWork classes for you based on Entity Framework 6:
https://www.nuget.org/packages/RepositoryGenerator/
精彩评论