Show / Hide Table of Contents

Class ApiServiceEF<TLoggerCategory, TResources, TDbContext>

Base class for all services implementing EntityFramework data access.

Inheritance
System.Object
ApiService<TLoggerCategory, TResources>
ApiServiceEF<TLoggerCategory, TResources, TDbContext>
Inherited Members
ApiService<TLoggerCategory, TResources>.ServiceProvider
ApiService<TLoggerCategory, TResources>.Config
ApiService<TLoggerCategory, TResources>.Logger
ApiService<TLoggerCategory, TResources>.Mapper
ApiService<TLoggerCategory, TResources>.HttpContext
ApiService<TLoggerCategory, TResources>.Dispose()
ApiService<TLoggerCategory, TResources>.Dispose(Boolean)
ApiService<TLoggerCategory, TResources>.StartLog()
ApiService<TLoggerCategory, TResources>.EndLog(String)
ApiService<TLoggerCategory, TResources>.LocalizeString(String)
ApiService<TLoggerCategory, TResources>.LocalizeString(String, Object[])
ApiService<TLoggerCategory, TResources>.Validate<TPayload>(TPayload, String, String)
ApiService<TLoggerCategory, TResources>.Error<TStatusCode>(String, String)
ApiService<TLoggerCategory, TResources>.Error<TStatusCode>(TStatusCode)
ApiService<TLoggerCategory, TResources>.Ok<TData, TStatusCode>(Object, TStatusCode)
ApiService<TLoggerCategory, TResources>.ProcessResponse<TData, TStatusCode>(ApiResponse<TData, TStatusCode>, TStatusCode)
Namespace: Celerik.NetCore.Services
Assembly: cs.temp.dll.dll
Syntax
public abstract class ApiServiceEF<TLoggerCategory, TResources, TDbContext> : ApiService<TLoggerCategory, TResources> where TDbContext : DbContext
Type Parameters
Name Description
TLoggerCategory

The type who's name is used for the logger category name.

TResources

The type used to localize string resources.

TDbContext

The type of DbContext.

Constructors

ApiServiceEF(ApiServiceArgs<TLoggerCategory>)

Initializes a new instance of the class.

Declaration
public ApiServiceEF(ApiServiceArgs<TLoggerCategory> args)
Parameters
Type Name Description
ApiServiceArgs<TLoggerCategory> args

Encapsulates the properties to initialize a new ApiService<TLoggerCategory>.

ApiServiceEF(ApiServiceArgsEF<TLoggerCategory, TDbContext>)

Initializes a new instance of the class.

Declaration
public ApiServiceEF(ApiServiceArgsEF<TLoggerCategory, TDbContext> args)
Parameters
Type Name Description
ApiServiceArgsEF<TLoggerCategory, TDbContext> args

Encapsulates the properties to initialize a new ApiServiceEF<TLoggerCategory, TDbContext>.

Properties

DbContext

Reference to the current DbContext instance.

Declaration
protected TDbContext DbContext { get; }
Property Value
Type Description
TDbContext

Methods

DetachEntities(IEnumerable<Object>)

Detaches all tracked entities from the DbContext.

Declaration
protected void DetachEntities(IEnumerable<object> excludedEntities = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Object> excludedEntities

List of entities to be excluded in the detaching proccess.

SaveAsync(ApiChangeAction, Object, Boolean)

Performs an Add/Insert/Delete of an entity into the DbContext.

Declaration
protected virtual Task SaveAsync(ApiChangeAction operation, object entity, bool commit = true)
Parameters
Type Name Description
ApiChangeAction operation

The type of operation to perform on the DbContext.

System.Object entity

The entity to Add/Insert/Delete.

System.Boolean commit

Indicates whether changes should be commited immediately.

Returns
Type Description
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

SetConnectionString(String)

Sets the current ConnectionString.

Declaration
protected void SetConnectionString(string connectionString)
Parameters
Type Name Description
System.String connectionString

String used to open the connection.

In This Article
Back to top Generated by DocFX