Show / Hide Table of Contents

Class DatabaseAccess

Provides the means to access a database table or view. This class contains all the standard CRUD methods to work with a table or view.

Inheritance
System.Object
DatabaseAccess
DatabaseAccess<TEntity>
Implements
IDatabaseAccess
IDisposable
Namespace: Paradigm.ORM.Data.DatabaseAccess
Assembly: Paradigm.ORM.Data.dll
Syntax
public class DatabaseAccess : object, IDatabaseAccess, IDisposable

Constructors

| Improve this Doc View Source

DatabaseAccess(IServiceProvider, IDatabaseConnector, ITableTypeDescriptor)

Initializes a new instance of the DatabaseAccess class.

Declaration
public DatabaseAccess(IServiceProvider serviceProvider, IDatabaseConnector connector, ITableTypeDescriptor descriptor)
Parameters
Type Name Description
IServiceProvider serviceProvider

The service provider.

IDatabaseConnector connector

The database connector.

ITableTypeDescriptor descriptor

The table type descriptor.

| Improve this Doc View Source

DatabaseAccess(IServiceProvider, IDatabaseConnector, Type)

Initializes a new instance of the DatabaseAccess class.

Declaration
public DatabaseAccess(IServiceProvider serviceProvider, IDatabaseConnector connector, Type type)
Parameters
Type Name Description
IServiceProvider serviceProvider

A reference to the scoped service provider.

IDatabaseConnector connector

A reference to the scoped database connector.

Type type

A type containing mapping information, or referencing typing information.

| Improve this Doc View Source

DatabaseAccess(IServiceProvider, Type)

Initializes a new instance of the DatabaseAccess class.

Declaration
public DatabaseAccess(IServiceProvider serviceProvider, Type type)
Parameters
Type Name Description
IServiceProvider serviceProvider

A reference to the scoped service provider.

Type type

A type containing mapping information, or referencing typing information.

| Improve this Doc View Source

DatabaseAccess(IDatabaseConnector, ITableTypeDescriptor)

Initializes a new instance of the DatabaseAccess class.

Declaration
public DatabaseAccess(IDatabaseConnector connector, ITableTypeDescriptor descriptor)
Parameters
Type Name Description
IDatabaseConnector connector

A reference to the scoped database connector.

ITableTypeDescriptor descriptor

The table type descriptor.

| Improve this Doc View Source

DatabaseAccess(IDatabaseConnector, Type)

Initializes a new instance of the DatabaseAccess class.

Declaration
public DatabaseAccess(IDatabaseConnector connector, Type type)
Parameters
Type Name Description
IDatabaseConnector connector

A reference to the scoped database connector.

Type type

A type containing mapping information, or referencing typing information.

Properties

| Improve this Doc View Source

BatchManager

Gets the batch manager.

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

CommandBuilderManager

Gets the command builder manager.

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

Connector

Gets the database connector.

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

Descriptor

Gets the table type descriptor.

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

Mapper

Gets or sets the mapper.

Declaration
protected IDatabaseReaderMapper Mapper { get; set; }
Property Value
Type Description
IDatabaseReaderMapper
| Improve this Doc View Source

NavigationDatabaseAccesses

Gets the list of navigation database access.

Declaration
protected List<INavigationDatabaseAccess> NavigationDatabaseAccesses { get; }
Property Value
Type Description
List<INavigationDatabaseAccess>
| Improve this Doc View Source

ServiceProvider

Gets the service provider.

Declaration
protected IServiceProvider ServiceProvider { get; }
Property Value
Type Description
IServiceProvider

Methods

| Improve this Doc View Source

AfterInitialize()

Executes logic after the instance has been initialized.

Declaration
protected virtual void AfterInitialize()
| Improve this Doc View Source

BeforeInitialize()

Executes logic previous to initialize the instance.

Declaration
protected virtual void BeforeInitialize()
| Improve this Doc View Source

Delete(IEnumerable<Object>)

Deletes a list of objects from the table or view.

Declaration
public virtual void Delete(IEnumerable<object> entities)
Parameters
Type Name Description
IEnumerable<System.Object> entities

List of entities to delete.

Remarks

This method utilizes batching to prevent unnecessary roundtrips to the database.

| Improve this Doc View Source

Delete(Object)

Deletes an object from the table or view.

Declaration
public virtual void Delete(object entity)
Parameters
Type Name Description
System.Object entity

Object to delete.

Remarks

If there are more than one element to delete, please use the overloaded method Paradigm.ORM.Data.DatabaseAccess.IDatabaseAccess.Delete(System.Collections.Generic.IEnumerable{System.Object}) because is prepared to batch the operation, and preventing unnecessary roundtrips to the database.

| Improve this Doc View Source

DeleteAsync(IEnumerable<Object>)

Deletes a list of objects from the table or view.

Declaration
public virtual Task DeleteAsync(IEnumerable<object> entities)
Parameters
Type Name Description
IEnumerable<System.Object> entities

List of entities to delete.

Returns
Type Description
Task
Remarks

This method utilizes batching to prevent unnecessary roundtrips to the database.

| Improve this Doc View Source

DeleteAsync(Object)

Deletes an object from the table or view.

Declaration
public virtual Task DeleteAsync(object entity)
Parameters
Type Name Description
System.Object entity

Object to delete.

Returns
Type Description
Task
Remarks

If there are more than one element to delete, please use the overloaded method Paradigm.ORM.Data.DatabaseAccess.IDatabaseAccess.Delete(System.Collections.Generic.IEnumerable{System.Object}) because is prepared to batch the operation, and preventing unnecessary roundtrips to the database.

| Improve this Doc View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public virtual void Dispose()
| Improve this Doc View Source

GetStoredProcedure<TProcedure>()

Gets the stored procedure from the service provider.

Declaration
protected TProcedure GetStoredProcedure<TProcedure>()where TProcedure : class, IRoutine
Returns
Type Description
TProcedure

A instance of the stored procedure.

Type Parameters
Name Description
TProcedure

The type of the procedure.

Remarks

The stored procedure must be registered or this method will fail.

| Improve this Doc View Source

Insert(IEnumerable<Object>)

Inserts a list of objects into the table or view.

Declaration
public virtual void Insert(IEnumerable<object> entities)
Parameters
Type Name Description
IEnumerable<System.Object> entities

List of entities to insert.

Remarks

This method utilizes batching to prevent unnecessary roundtrips to the database.

| Improve this Doc View Source

Insert(Object)

Inserts an object into the table or view.

Declaration
public virtual void Insert(object entity)
Parameters
Type Name Description
System.Object entity

Object to insert.

Remarks

If there are more than one element to insert, please use the overloaded method Paradigm.ORM.Data.DatabaseAccess.IDatabaseAccess.Insert(System.Collections.Generic.IEnumerable{System.Object}) because is prepared to batch the operation, and preventing unnecessary roundtrips to the database.

| Improve this Doc View Source

InsertAsync(IEnumerable<Object>)

Inserts a list of objects into the table or view.

Declaration
public virtual Task InsertAsync(IEnumerable<object> entities)
Parameters
Type Name Description
IEnumerable<System.Object> entities

List of entities to insert.

Returns
Type Description
Task
Remarks

This method utilizes batching to prevent unnecessary roundtrips to the database.

| Improve this Doc View Source

InsertAsync(Object)

Inserts an object into the table or view.

Declaration
public virtual Task InsertAsync(object entity)
Parameters
Type Name Description
System.Object entity

Object to insert.

Returns
Type Description
Task
Remarks

If there are more than one element to insert, please use the overloaded method Paradigm.ORM.Data.DatabaseAccess.IDatabaseAccess.Insert(System.Collections.Generic.IEnumerable{System.Object}) because is prepared to batch the operation, and preventing unnecessary roundtrips to the database.

| Improve this Doc View Source

Select()

Selects a list of all the elements in a table or view.

Declaration
public virtual List<object> Select()
Returns
Type Description
List<System.Object>

A list of objects that belong to the table or view.

Remarks

To select filtering results, use the overloaded method Paradigm.ORM.Data.DatabaseAccess.IDatabaseAccess.Select(System.String).

| Improve this Doc View Source

Select(String, Object[])

Selects a list of elements in a table or view.

Declaration
public virtual List<object> Select(string whereClause, params object[] parameters)
Parameters
Type Name Description
System.String whereClause

A where filter clause. Do not add the "WHERE" keyword to it. If you need to pass parameters, pass using @1, @2, @3.

System.Object[] parameters

A list of parameter values.

Returns
Type Description
List<System.Object>

A list of objects that belong to the table or view.

| Improve this Doc View Source

SelectAsync()

Selects a list of all the elements in a table or view.

Declaration
public virtual Task<List<object>> SelectAsync()
Returns
Type Description
Task<List<System.Object>>

A list of objects that belong to the table or view.

Remarks

To select filtering results, use the overloaded method Paradigm.ORM.Data.DatabaseAccess.IDatabaseAccess.Select(System.String).

| Improve this Doc View Source

SelectAsync(String, Object[])

Selects a list of elements in a table or view.

Declaration
public virtual Task<List<object>> SelectAsync(string whereClause, params object[] parameters)
Parameters
Type Name Description
System.String whereClause

A where filter clause. Do not add the "WHERE" keyword to it. If you need to pass parameters, pass using @1, @2, @3.

System.Object[] parameters

A list of parameter values.

Returns
Type Description
Task<List<System.Object>>

A list of objects that belong to the table or view.

| Improve this Doc View Source

SelectOne(Object[])

Selects one element from the database.

Declaration
public virtual object SelectOne(params object[] ids)
Parameters
Type Name Description
System.Object[] ids

Array of id values.

Returns
Type Description
System.Object

Element with the same id values as the values provider; otherwise null.

| Improve this Doc View Source

SelectOneAsync(Object[])

Selects one element from the database.

Declaration
public virtual Task<object> SelectOneAsync(params object[] ids)
Parameters
Type Name Description
System.Object[] ids

Array of id values.

Returns
Type Description
Task<System.Object>

Element with the same id values as the values provider; otherwise null.

| Improve this Doc View Source

Update(IEnumerable<Object>)

Updates a list of objects stored in the table or view.

Declaration
public virtual void Update(IEnumerable<object> entities)
Parameters
Type Name Description
IEnumerable<System.Object> entities

List of entities to update.

Remarks

This method utilizes batching to prevent unnecessary roundtrips to the database.

| Improve this Doc View Source

Update(Object)

Updates an object already stored in the table or view.

Declaration
public virtual void Update(object entity)
Parameters
Type Name Description
System.Object entity

Object to insert.

Remarks

If there are more than one element to update, please use the overloaded method Paradigm.ORM.Data.DatabaseAccess.IDatabaseAccess.Update(System.Collections.Generic.IEnumerable{System.Object}) because is prepared to batch the operation, and preventing unnecessary roundtrips to the database.

| Improve this Doc View Source

UpdateAsync(IEnumerable<Object>)

Updates a list of objects stored in the table or view.

Declaration
public virtual Task UpdateAsync(IEnumerable<object> entities)
Parameters
Type Name Description
IEnumerable<System.Object> entities

List of entities to update.

Returns
Type Description
Task
Remarks

This method utilizes batching to prevent unnecessary roundtrips to the database.

| Improve this Doc View Source

UpdateAsync(Object)

Updates an object already stored in the table or view.

Declaration
public virtual Task UpdateAsync(object entity)
Parameters
Type Name Description
System.Object entity

Object to insert.

Returns
Type Description
Task
Remarks

If there are more than one element to update, please use the overloaded method Paradigm.ORM.Data.DatabaseAccess.IDatabaseAccess.Update(System.Collections.Generic.IEnumerable{System.Object}) because is prepared to batch the operation, and preventing unnecessary roundtrips to the database.

Implements

IDatabaseAccess
IDisposable

Extension Methods

ObjectExtensions.ThrowIfFails<TException>(Object, Action, String)
ObjectExtensions.ThrowIfFails<TException, TResult>(Object, Func<TResult>, String)
ObjectExtensions.ThrowIfFailsAsync<TException>(Object, Func<Task>, String)
ObjectExtensions.ThrowIfFailsAsync<TException, TResult>(Object, Func<Task<TResult>>, String)

See Also

IDatabaseAccess
  • Improve this Doc
  • View Source
Powered by MiracleDevs ©2017. Code licensed under the MIT License.
Documentation generated by DocFX.