using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace Wierszowki.Core.Interfaces { /// /// Contact for the Repository pattern /// /// public interface IRepository where T : IIdentifiable { /// /// Returns a count of the items in the repository /// int Count(); /// /// Returns a count of the items in the repository which match the supplied lambda /// /// A lambda expression which will be evaluated against the repository int Count(Expression> expression); /// /// Adds a new entity in to the repository /// void Insert(T entity); /// /// Removes the specified entity from the repository /// void Delete(T entity); /// /// Saves the specified entity back to the repository /// void Update(T entity); /// /// Finds a single instance of an entity matching a unique identifier. /// T FindOne(int id); /// /// Finds a single instance of an entity matching a lambda expression /// /// The first entity which matches the expession T FindOne(Expression> expression); /// /// Tries the find one. /// /// The expression. /// The entity. /// bool TryFindOne(Expression> expression, out T entity); /// /// Tries the find one. /// /// The expression. /// bool Exists(Expression> expression); /// /// Finds all entities in the repository /// /// IList FindAll(); /// /// Finds all entities matching a lambda expression /// /// The expression. /// IList FindAll(Expression> expression); /// /// Returns a requeryable set of all entities in the repository /// IQueryable Find(); /// /// Returns a requeryable set of all entities in the repository matching a unique identifier /// IQueryable Find(int id); /// /// Returns a requeryable set of all entities in the repository matching a lambda expression /// IQueryable Find(Expression> expression); } }