Products

Solutions

Resources

Partners

Community

Blog

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

DAL 2 - IRepository Interface

Return to previous page

  • 4/7/2015
  • 2378 Views

Comments

2378 Views

DAL 2 - IRepository Interface

Last updated 7 years ago

Comments

Common

(Enter the content of this article below)

Advanced

 
The IRepository<T> interface can be considered the core of the new DAL 2. While the Execute methods of the IDataContext interface provide a DAL + like API, the benefits of the new API are really found when using the repository. The Repository Pattern is a common design pattern in modern data access layers. Martin Fowler’s definition of the pattern is:

Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.

The pattern at its simplest provides simple CRUD (Create, Retrieve, Update and Delete) methods. In the DotNetNuke implementation there are a few extra overloads to provide flexibility.

public interface IRepository<T> where T : class

{
void Delete(T item);

void Delete(string sqlCondition, params object[] args);

IEnumerable<T> Find(string sqlCondition, params object[] args);

IPagedList<T> Find(int pageIndex, int pageSize, string sqlCondition, params object[] args);

IEnumerable<T> Get();

IEnumerable<T> Get<TScopeType>(TScopeType scopeValue);

T GetById<TProperty>(TProperty id);

T GetById<TProperty, TScopeType>(TProperty id, TScopeType scopeValue);

IPagedList<T> GetPage(int pageIndex, int pageSize);

IPagedList<T> GetPage<TScopeType>(TScopeType scopeValue, int pageIndex, int pageSize);

void Insert(T item);

void Update(T item);

void Update(string sqlCondition, params object[] args);
}

What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out