I am developing a small app in .net. This app basically calls 6 to7 stored proc and 3 tables and then updates data to another table. I thought using entity framework with repository pattern was an overkill for this. A data layer class with static methods looks too simple.
Any thoughts on how to design data layer ?
First of all, Entity Framework works well with or without Repositories!
One of the Repository Pattern's goal is to add an abstraction layer between Doamin and Data layers.
If you're creating a simple application, where you're the only developper involved, keep in mind KISS and YAGNI principles!
Just create a Presentation layer, that will call Services in a Business layer, that will be responsible to call EF like this:
public void InsertThings(Entity1 entity1)
{
using (var context = new MyContext())
{
var entity1 = new Entity1 { Name = "My first Entity" };
context.Entity1.Add(entity1);
context.SaveChanges();
}
}
public IEnumerable<Customer> GetCustomers()
{
var customers = db.customers
return customers.ToList();
}