Based on this question and this other question , in an environment that uses Entity Framework
and Asp.net MVC
.
I see in many examples not using the application layer, a use of the data layer ( Entity Framework
) in Controller
. Then come my first doubt:
Is it really necessary to use this layer? And what are the advantages of using it?
Following the rationale, in an environment where there are no data exclusions, rather an active field.
In order to list the data and delete it (change the value of the active field):
Which layer is responsible for this? The data access layer, the application layer, or Controller
?
The last question is regarding includes.
Implementing this method in the data layer ( Entity Framework
):
public IQueryable<T> Query(params Expression<Func<T, object>>[] includes)
{
IQueryable<T> Set = this.Query();
foreach (var include in includes)
{
Set = Set.Include(include);
}
return Set;
}
It would be the duty of the application layer to tell which features it will use or the Controller
?
In the background, it is not very clear to me what the real responsibility of the application layer is.
Until then, my only responsibility was to make the user interaction layer ( Controller
) not have to be related to the data layer.