2
Based that question and that other question, in an environment that uses the Entity Framework
and Asp.net MVC
.
I see in many examples the non-use of the application layer, a use of the data layer (Entity Framework
) in the Controller
. Then comes my first doubt:
Is it really necessary to use this layer? And what are the advantages of its use?
Following the reasoning, in an environment where there are no data exclusions but an active field.
Regarding listing and deleting data (change the value of the active field):
Which layer is responsible for this? The data access layer, the application layer, or else the Controller
?
The last question is about 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 includes it will use or else the Controller
?
Basically, it is not very clear to me what the real responsibility of the application layer.
Until then for me its only responsibility was to make the layer of user interaction (Controller
) did not need to be related to the data layer.
Linked: http://answall.com/questions/51536/quando-usar-entity-framework-com-repository-pattern/80696#80696
– Leonel Sanches da Silva