To close this topic, here is what I ended up doing:
. Unit of Work - , , . UoW . UoW . .
, , , , - :
public interface ICustomerManager
{
ICustomer GetCustomer(Guid customerId);
void SaveCustomer(ICustomer customer);
}
public class CustomerManager : ICustomerManager
{
public CustomerManager(ICustomerRepository repository)
{
Repository = repository;
}
public ICustomerRepository Repository { get; private set; }
public ICustomer GetCustomer(Guid customerId)
{
return Repository.SingleOrDefault(c => c.ID == customerId);
}
public void SaveCustomer(ICustomer customer)
{
Repository.Save(customer);
}
}
public interface ICustomerRepository : IQueryable<ICustomer>
{
void Save(ICustomer customer);
}
, ICustomerRepository CustomerManager . , . , , , , .
, Linq-to-SQL, LinqCustomerRepository, ICustomerRepository Customer, ICustomer. L2S ICustomer UoW , , L2S.