MappedEntityDomainManager<TData,TModel> Class

Definition

Provides an DomainManager<TData> implementation targeting SQL as the backend store using Entity Framework where there is not a 1:1 mapping between the data object (DTO) exposed through a TableController<TData> and the domain model managed by SQL. See EntityDomainManager<TData> for situations where there is a 1:1 relationship between the Data Object (DTO) and the domain model managed by SQL.

public abstract class MappedEntityDomainManager<TData,TModel> : Microsoft.Azure.Mobile.Server.Tables.DomainManager<TData> where TData : class, ITableData where TModel : class
type MappedEntityDomainManager<'Data, 'Model (requires 'Data : null and 'Data :> ITableData and 'Model : null)> = class
    inherit DomainManager<'Data (requires 'Data : null and 'Data :> ITableData)>
Public MustInherit Class MappedEntityDomainManager(Of TData, TModel)
Inherits DomainManager(Of TData)

Type Parameters

TData

The data object (DTO) type.

TModel

The type of the domain data model

Inheritance
System.Object
MappedEntityDomainManager<TData,TModel>

Remarks

The MappedEntityDomainManager<TData,TModel> leverages AutoMapper to map between the DTO and the domain model and it is assumed that AutoMapper has already been initialized with appropriate mappings that map from DTO => domain model and from domain model => DTO. The bi-directional mapping is required for both reads (GET, QUERY) and updates (PUT, POST, DELETE, PATCH) to function.

Constructors

MappedEntityDomainManager<TData,TModel>(DbContext, HttpRequestMessage)

Creates a new instance of MappedEntityDomainManager<TData,TModel>

MappedEntityDomainManager<TData,TModel>(DbContext, HttpRequestMessage, Boolean)

Creates a new instance of MappedEntityDomainManager<TData,TModel>

Properties

Context
EnableSoftDelete

Determines whether rows are hard deleted or marked as deleted. False by default.

(Inherited from DomainManager<TData>)
IncludeDeleted

Determines whether soft deleted records are included in query results. True by default.

(Inherited from DomainManager<TData>)
Request

Instance of System.Net.Http.HttpRequestMessage

(Inherited from DomainManager<TData>)

Methods

DeleteAsync(String)

Deletes an existing item

(Inherited from DomainManager<TData>)
DeleteItemAsync(Object[])
GetCompositeKey(String)
GetKey<TKey>(String)
GetKey<TKey>(String, CultureInfo)
GetOriginalValue(DbUpdateConcurrencyException)

Gets the original value of an entity in case an update or replace operation resulted in an System.Data.Entity.Infrastructure.DbUpdateConcurrencyException. The original value extracted from the exception will get returned to the client so that it can merge the data and possibly try the operation again.

InsertAsync(TData)
Lookup(String)

Builds an System.Linq.IQueryable`1 to be executed against a store supporting System.Linq.IQueryable`1 for looking up a single item.

(Inherited from DomainManager<TData>)
LookupAsync(String)
LookupEntity(Expression<Func<TModel,Boolean>>)
LookupEntity(Expression<Func<TModel,Boolean>>, Boolean)
Query()
QueryAsync(ODataQueryOptions)
ReplaceAsync(String, TData)
SetOriginalVersion(TModel, Byte[])

Override this method to support optimistic concurrent updates and replace operations. In order to evaluate whether an object has been updated concurrently, Entity Framework needs to know the original version of the object being edited and compare that to the current version maintained in the database. This requires that the original value is known by Entity Framework so that it can ask the database to do the check.

SubmitChangesAsync()

Submits the change through Entity Framework while logging any exceptions and produce appropriate System.Net.Http.HttpResponseMessage instances.

UndeleteAsync(String, Delta<TData>)
UpdateAsync(String, Delta<TData>)

Updates an existing item by applying a System.Web.Http.OData.Delta`1 patch to it. The System.Web.Http.OData.Delta`1 abstraction keeps track of which properties have changed which avoids problems with default values and the like.

(Inherited from DomainManager<TData>)
UpdateAsync(String, Delta<TData>, Boolean)
UpdateEntityAsync(Delta<TData>, Boolean, Object[])
UpdateEntityAsync(Delta<TData>, Object[])

Applies to