I need feedback on designing such a repository, it'll help me rest at night, seriously...
I have no intention to write tests for web forms, too much overhead involved.
I have no intention to change ORM or database tomorrow, next month or next year and
I need a place to centralize query logic and avoid code duplication. Right?...
public class StuffRepository // no contract, I simply instanciate StuffRepository
{
// Scope is Per-Request, DI, no abstraction...
protected StuffDb DbContext = ObjectFactory.GetInstance<StuffDb>();
// Returns a Stuff, an Entity (EF), no abstraction
public Stuff Get(Guid id)
{
return DbContext.Stuff.FirstOrDefault(s => s.Id == id);
}
}
I have worked with fully abstracted repositories, MVP architecture on top of web form for individual pages testability and abstracted entities (DTO and domain/model objects). It's just never ending, it's never enough, never perfect.
Am I violating every rules, principles and giving birth to an aberration calling this a repository?
If I'd just rename this to StuffDAL
, would it suddenly make any sense?
Thanks