• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class RepositoryBase<T>

Inheritance
System.Object
RepositoryBase<T>
PetaPocoRepository<T>
Implements
IRepository<T>
Namespace: DotNetNuke.Data
Assembly: DotNetNuke.dll
Syntax
public abstract class RepositoryBase<T> : object, IRepository<T> where T : class
Type Parameters
Name Description
T

Constructors

| Improve this Doc View Source

RepositoryBase()

Initializes a new instance of the RepositoryBase<T> class.

Declaration
protected RepositoryBase()

Properties

| Improve this Doc View Source

CacheArgs

Declaration
protected CacheItemArgs CacheArgs { get; }
Property Value
Type Description
CacheItemArgs
| Improve this Doc View Source

IsCacheable

Declaration
protected bool IsCacheable { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsScoped

Declaration
protected bool IsScoped { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Scope

Declaration
protected string Scope { get; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

CompareTo<TProperty>(TProperty, TProperty)

Declaration
protected int CompareTo<TProperty>(TProperty first, TProperty second)
Parameters
Type Name Description
TProperty first
TProperty second
Returns
Type Description
System.Int32
Type Parameters
Name Description
TProperty
| Improve this Doc View Source

Delete(T)

Delete an Item from the repository.

Declaration
public void Delete(T item)
Parameters
Type Name Description
T item

The item to be deleted.

| Improve this Doc View Source

Delete(String, Object[])

Delete items from the repository based on a sql Condition.

Declaration
public abstract void Delete(string sqlCondition, params object[] args)
Parameters
Type Name Description
System.String sqlCondition

The sql condition e.g. "WHERE ArticleId = {0}".

System.Object[] args

A collection of arguments to be mapped to the tokens in the sqlCondition.

| Improve this Doc View Source

DeleteInternal(T)

Declaration
protected abstract void DeleteInternal(T item)
Parameters
Type Name Description
T item
| Improve this Doc View Source

Find(Int32, Int32, String, Object[])

Find a GetPage of items from the repository based on a sql condition.

Declaration
public abstract IPagedList<T> Find(int pageIndex, int pageSize, string sqlCondition, params object[] args)
Parameters
Type Name Description
System.Int32 pageIndex

The page Index to fetch.

System.Int32 pageSize

The size of the page to fetch.

System.String sqlCondition

The sql condition e.g. "WHERE ArticleId = @0".

System.Object[] args

A collection of arguments to be mapped to the tokens in the sqlCondition.

Returns
Type Description
IPagedList<T>

A list of items.

Remarks

Find supports both full SQL statements such as "SELECT * FROM table WHERE ..." as well as a SQL condition like "WHERE ...".

| Improve this Doc View Source

Find(String, Object[])

Find items from the repository based on a sql condition.

Declaration
public abstract IEnumerable<T> Find(string sqlCondition, params object[] args)
Parameters
Type Name Description
System.String sqlCondition

The sql condition e.g. "WHERE ArticleId = @0".

System.Object[] args

A collection of arguments to be mapped to the tokens in the sqlCondition.

Returns
Type Description
IEnumerable<T>

A list of items.

Remarks

Find supports both full SQL statements such as "SELECT * FROM table WHERE ..." as well as a SQL condition like "WHERE ...".

| Improve this Doc View Source

Get()

Returns all the items in the repository as an enumerable list.

Declaration
public IEnumerable<T> Get()
Returns
Type Description
IEnumerable<T>

The list of items.

| Improve this Doc View Source

Get<TScopeType>(TScopeType)

Returns an enumerable list of items filtered by scope.

Declaration
public IEnumerable<T> Get<TScopeType>(TScopeType scopeValue)
Parameters
Type Name Description
TScopeType scopeValue

The value of the scope to filter by.

Returns
Type Description
IEnumerable<T>

The list of items.

Type Parameters
Name Description
TScopeType

The type of the scope field.

Remarks

This overload should be used to get a list of items for a specific module instance or for a specific portal dependening on how the items in the repository are scoped.

| Improve this Doc View Source

GetById<TProperty>(TProperty)

Get an individual item based on the items Id field.

Declaration
public T GetById<TProperty>(TProperty id)
Parameters
Type Name Description
TProperty id

The value of the Id field.

Returns
Type Description
T

An item.

Type Parameters
Name Description
TProperty

The type of the Id field.

| Improve this Doc View Source

GetById<TProperty, TScopeType>(TProperty, TScopeType)

Get an individual item based on the items Id field.

Declaration
public T GetById<TProperty, TScopeType>(TProperty id, TScopeType scopeValue)
Parameters
Type Name Description
TProperty id

The value of the Id field.

TScopeType scopeValue

The value of the scope to filter by.

Returns
Type Description
T

An item.

Type Parameters
Name Description
TProperty

The type of the Id field.

TScopeType

The type of the scope field.

Remarks

This overload should be used to get an item for a specific module instance or for a specific portal dependening on how the items in the repository are scoped. This will allow the relevant cache to be searched first.

| Improve this Doc View Source

GetByIdInternal(Object)

Declaration
protected abstract T GetByIdInternal(object id)
Parameters
Type Name Description
System.Object id
Returns
Type Description
T
| Improve this Doc View Source

GetByScopeInternal(Object)

Declaration
protected abstract IEnumerable<T> GetByScopeInternal(object propertyValue)
Parameters
Type Name Description
System.Object propertyValue
Returns
Type Description
IEnumerable<T>
| Improve this Doc View Source

GetInternal()

Declaration
protected abstract IEnumerable<T> GetInternal()
Returns
Type Description
IEnumerable<T>
| Improve this Doc View Source

GetPage(Int32, Int32)

Returns a page of items in the repository as a paged list.

Declaration
public IPagedList<T> GetPage(int pageIndex, int pageSize)
Parameters
Type Name Description
System.Int32 pageIndex

The page Index to fetch.

System.Int32 pageSize

The size of the page to fetch.

Returns
Type Description
IPagedList<T>

The list of items.

| Improve this Doc View Source

GetPage<TScopeType>(TScopeType, Int32, Int32)

Returns a page of items in the repository as a paged list filtered by scope.

Declaration
public IPagedList<T> GetPage<TScopeType>(TScopeType scopeValue, int pageIndex, int pageSize)
Parameters
Type Name Description
TScopeType scopeValue

The value of the scope to filter by.

System.Int32 pageIndex

The page Index to fetch.

System.Int32 pageSize

The size of the page to fetch.

Returns
Type Description
IPagedList<T>

The list of items.

Type Parameters
Name Description
TScopeType

The type of the scope field.

Remarks

This overload should be used to get a list of items for a specific module instance or for a specific portal dependening on how the items in the repository are scoped.

| Improve this Doc View Source

GetPageByScopeInternal(Object, Int32, Int32)

Declaration
protected abstract IPagedList<T> GetPageByScopeInternal(object propertyValue, int pageIndex, int pageSize)
Parameters
Type Name Description
System.Object propertyValue
System.Int32 pageIndex
System.Int32 pageSize
Returns
Type Description
IPagedList<T>
| Improve this Doc View Source

GetPageInternal(Int32, Int32)

Declaration
protected abstract IPagedList<T> GetPageInternal(int pageIndex, int pageSize)
Parameters
Type Name Description
System.Int32 pageIndex
System.Int32 pageSize
Returns
Type Description
IPagedList<T>
| Improve this Doc View Source

GetPrimaryKey<TProperty>(T)

Declaration
protected TProperty GetPrimaryKey<TProperty>(T item)
Parameters
Type Name Description
T item
Returns
Type Description
TProperty
Type Parameters
Name Description
TProperty
| Improve this Doc View Source

GetPropertyValue<TProperty>(T, String)

Declaration
protected TProperty GetPropertyValue<TProperty>(T item, string propertyName)
Parameters
Type Name Description
T item
System.String propertyName
Returns
Type Description
TProperty
Type Parameters
Name Description
TProperty
| Improve this Doc View Source

GetScopeValue<TProperty>(T)

Declaration
protected TProperty GetScopeValue<TProperty>(T item)
Parameters
Type Name Description
T item
Returns
Type Description
TProperty
Type Parameters
Name Description
TProperty
| Improve this Doc View Source

Initialize(String, Int32, CacheItemPriority, String)

Declaration
public void Initialize(string cacheKey, int cacheTimeOut = 20, CacheItemPriority cachePriority = null, string scope = "")
Parameters
Type Name Description
System.String cacheKey
System.Int32 cacheTimeOut
CacheItemPriority cachePriority
System.String scope
| Improve this Doc View Source

Insert(T)

Inserts an Item into the repository.

Declaration
public void Insert(T item)
Parameters
Type Name Description
T item

The item to be inserted.

| Improve this Doc View Source

InsertInternal(T)

Declaration
protected abstract void InsertInternal(T item)
Parameters
Type Name Description
T item
| Improve this Doc View Source

Update(T)

Updates an Item in the repository.

Declaration
public void Update(T item)
Parameters
Type Name Description
T item

The item to be updated.

| Improve this Doc View Source

Update(String, Object[])

Update items in the repository based on a sql Condition.

Declaration
public abstract void Update(string sqlCondition, params object[] args)
Parameters
Type Name Description
System.String sqlCondition

The sql condition e.g. "SET ArticelName = @1 WHERE ArticleId = @0".

System.Object[] args

A collection of arguments to be mapped to the tokens in the sqlCondition.

| Improve this Doc View Source

UpdateInternal(T)

Declaration
protected abstract void UpdateInternal(T item)
Parameters
Type Name Description
T item

Implements

IRepository<T>

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS