1. Does it matter that there is no clear distinction between BLL and DAL ?.
Of course, this is important! Any programmer using the Table property must understand the fork (database callback, query translation, object tracking). This also applies to programmers reading business logic classes.
2. The information requested by the user is considered as access to data or business logic, if behind the layer of the repository, which acts as an abstraction of InMemory?
Abstraction is a blanket in which we hide our problems.
If your abstraction is perfect, queries can be abstractly viewed as working with collections in memory, and therefore they are not data access.
However, abstraction leakage. If you want queries that make sense in the data world, you must make efforts to work on the abstraction and beyond. This extra effort (which defeats abstraction) creates a data access code.
Some examples:
output = work.GetRepository<Bar>().Table.ToArray();
This code is (abstract) excellent. But in the data world, this leads to a scan of the entire table and (at least in general) dumb!
badquery = work.GetRepository<Customer>().Table.Where(c => c.Name.Contains("Bob")).ToArray(); goodquery = work.GetRepository<Customer>().Table.Where(c => c.Name.StartsWith("Bob")).ToArray();
Goodquery is better than a bad query when there is an index on Customer.Name . But this fact is not available to us unless we raise the abstraction.
badquery = work.GetRepository<Customer>().Table .GroupBy(c => c.Orders.Count()) .Select(g => new { TheCount = g.Key, TheCustomers = g.ToList() }).ToArray(); goodquery = work.GetRepository<Customer>().Table .Select(c => new {Customer = c, theCount = c.Orders.Count()) .ToArray() .GroupBy(x => x.theCount) .Select(g => new { TheCount = g.Key, TheCustomers = g.Select(x => x.Customer).ToList() }) .ToArray();
goodquery is better than a bad query, because badquery will query the group key database for each group (and, even worse, it is very unlikely that there is an index that will help c.Orders.Count() clients c.Orders.Count() ).
Testability is built into the repository project. We can use the InMemory implementation to validate results with anticipation.
Resist the illusion that your queries are checked if you actually run them in collections in memory. These queries are not subject to testing if the database is not used.