Im a bit confused about what is best practice when working with Entity Framework and ASP.NET Web API.
I am working on a project that contains a iOS/Android app and an API the app will use to communicate with.
For now the project is seperated like this:
Project.Core (This project contains all database access like DbContext, Entity models, services that controls the logic of the system and the services will only return mapped models. The Entity models will never be exposed from this project)
Project.Models (This project contains all the mapped models that the app and API uses)
Project.Api (Contains all API controllers, actions and authorization logic. This project will use the Project.Core services to execute the desired action and will only work with the mapped models)
Now my question is:
Is it bad practice not to use the Entity Framework models and DbContext directly in the API project?
Is it bad practice to hide the Entity Framework models and DbContext from all other projects except the Project.Core?
My idea was to isolate all database related logic in a seperate project.