How can I create a generic data repository for my Entity Framework solution?
I recently created a quick console application that required CRUD activities on a SQL database. I had a few tables to update and did not want the headache of creating multiple items in my DAL. Enter a generic data repository. The code is pretty simple: 1. Create a base interface for the CRUD operations public interface IGenericDataRepository<T> where T : class { List<T> GetAll(params Expression<Func<T, object>>[] navigationProperties); List<T> GetList(Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties); T GetSingle(Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties); void Add(params T[] items); void Update(params T[] items); void Remove(params T[] items); ...