Table of Contents

Interface IEntityRepository

Namespace
JJMasterData.Commons.Data.Entity.Repository.Abstractions
Assembly
JJMasterData.Commons.dll
public interface IEntityRepository

Methods

CreateDataModel(Element, List<RelationshipReference>?)

void CreateDataModel(Element element, List<RelationshipReference>? relationships = null)

Parameters

element Element
relationships List<RelationshipReference>

CreateDataModelAsync(Element, List<RelationshipReference>?)

Create an element's tables and procedures

Task CreateDataModelAsync(Element element, List<RelationshipReference>? relationships = null)

Parameters

element Element
relationships List<RelationshipReference>

Returns

Task

Delete(Element, Dictionary<string, object>)

int Delete(Element element, Dictionary<string, object> primaryKeys)

Parameters

element Element
primaryKeys Dictionary<string, object>

Returns

int

DeleteAsync(Element, Dictionary<string, object>)

Delete records based on filter.

Task<int> DeleteAsync(Element element, Dictionary<string, object> primaryKeys)

Parameters

element Element
primaryKeys Dictionary<string, object>

Returns

Task<int>

ExecuteBatchAsync(string, Guid?)

Task<bool> ExecuteBatchAsync(string script, Guid? connectionId = null)

Parameters

script string
connectionId Guid?

Returns

Task<bool>

GetAlterTableScriptAsync(Element)

Task<string?> GetAlterTableScriptAsync(Element element)

Parameters

element Element

Returns

Task<string>

GetCount(Element, Dictionary<string, object?>)

int GetCount(Element element, Dictionary<string, object?> filters)

Parameters

element Element
filters Dictionary<string, object>

Returns

int

GetCountAsync(Element, Dictionary<string, object?>)

Task<int> GetCountAsync(Element element, Dictionary<string, object?> filters)

Parameters

element Element
filters Dictionary<string, object>

Returns

Task<int>

GetCreateTableScript(Element, List<RelationshipReference>?)

Build a structure script to create table

string GetCreateTableScript(Element element, List<RelationshipReference>? relationships = null)

Parameters

element Element
relationships List<RelationshipReference>

Returns

string

GetDataSet(DataAccessCommand, Guid?)

DataSet GetDataSet(DataAccessCommand command, Guid? connectionId = null)

Parameters

command DataAccessCommand
connectionId Guid?

Returns

DataSet

GetDataSetAsync(DataAccessCommand, Guid?, CancellationToken)

Task<DataSet> GetDataSetAsync(DataAccessCommand command, Guid? connectionId = null, CancellationToken cancellationToken = default)

Parameters

command DataAccessCommand
connectionId Guid?
cancellationToken CancellationToken

Returns

Task<DataSet>

GetDataTable(DataAccessCommand, Guid?)

DataTable GetDataTable(DataAccessCommand dataAccessCommand, Guid? connectionId = null)

Parameters

dataAccessCommand DataAccessCommand
connectionId Guid?

Returns

DataTable

GetDataTableAsync(DataAccessCommand, Guid?)

Task<DataTable> GetDataTableAsync(DataAccessCommand dataAccessCommand, Guid? connectionId = null)

Parameters

dataAccessCommand DataAccessCommand
connectionId Guid?

Returns

Task<DataTable>

GetDataTableAsync(Element, EntityParameters?)

Task<DataTable> GetDataTableAsync(Element element, EntityParameters? entityParameters = null)

Parameters

element Element
entityParameters EntityParameters

Returns

Task<DataTable>

GetDictionaryList(Element, EntityParameters?)

List<Dictionary<string, object?>> GetDictionaryList(Element element, EntityParameters? parameters = null)

Parameters

element Element
parameters EntityParameters

Returns

List<Dictionary<string, object>>

GetDictionaryListAsync(DataAccessCommand, Guid?)

Task<List<Dictionary<string, object?>>> GetDictionaryListAsync(DataAccessCommand command, Guid? connectionId = null)

Parameters

command DataAccessCommand
connectionId Guid?

Returns

Task<List<Dictionary<string, object>>>

GetDictionaryListAsync(Element, EntityParameters?)

Task<List<Dictionary<string, object?>>> GetDictionaryListAsync(Element element, EntityParameters? parameters = null)

Parameters

element Element
parameters EntityParameters

Returns

Task<List<Dictionary<string, object>>>

GetDictionaryListResult(Element, EntityParameters?, bool)

DictionaryListResult GetDictionaryListResult(Element element, EntityParameters? parameters = null, bool recoverTotalOfRecords = true)

Parameters

element Element
parameters EntityParameters
recoverTotalOfRecords bool

Returns

DictionaryListResult

GetDictionaryListResultAsync(Element, EntityParameters?, bool)

Returns records from the database based on the filter.

Task<DictionaryListResult> GetDictionaryListResultAsync(Element element, EntityParameters? parameters = null, bool recoverTotalOfRecords = true)

Parameters

element Element
parameters EntityParameters
recoverTotalOfRecords bool

Returns

Task<DictionaryListResult>

Returns a DictionaryListResult with the records found and the count of records at your data source.

GetElementFromTableAsync(string, Guid?)

Build a element from a existing table

Task<Element> GetElementFromTableAsync(string tableName, Guid? connectionId = null)

Parameters

tableName string
connectionId Guid?

Returns

Task<Element>

GetFields(DataAccessCommand, Guid?)

Dictionary<string, object?> GetFields(DataAccessCommand command, Guid? connectionId = null)

Parameters

command DataAccessCommand
connectionId Guid?

Returns

Dictionary<string, object>

GetFields(Element, Dictionary<string, object>)

Dictionary<string, object?> GetFields(Element element, Dictionary<string, object> primaryKeys)

Parameters

element Element
primaryKeys Dictionary<string, object>

Returns

Dictionary<string, object>

GetFieldsAsync(DataAccessCommand, Guid?)

Task<Dictionary<string, object?>> GetFieldsAsync(DataAccessCommand command, Guid? connectionId = null)

Parameters

command DataAccessCommand
connectionId Guid?

Returns

Task<Dictionary<string, object>>

GetFieldsAsync(Element, Dictionary<string, object>)

Task<Dictionary<string, object?>> GetFieldsAsync(Element element, Dictionary<string, object> primaryKeys)

Parameters

element Element
primaryKeys Dictionary<string, object>

Returns

Task<Dictionary<string, object>>

GetListFieldsAsTextAsync(Element, EntityParameters?, bool, string)

Returns database records based on filter.

Task<string> GetListFieldsAsTextAsync(Element element, EntityParameters? parameters = null, bool showLogInfo = false, string delimiter = "|")

Parameters

element Element

Structure basic from a table

parameters EntityParameters
showLogInfo bool

Records detailed log of each operation

delimiter string

Field delimiter in text file (default is pipe)

Returns

Task<string>

Returns a string with one record per line separated by the delimiter.

If no record is found it returns null.

*Warning:

  • Some special characters will be replaced:

    enter = #182;

    {delimiter} = #124;

  • Submitted formats:

    Numbers = en-US

    Date = yyyy-MM-dd HH:mm:ss

GetReadProcedureScript(Element)

Build a structure script to procedure of get

string? GetReadProcedureScript(Element element)

Parameters

element Element

Returns

string

GetResultAsync(DataAccessCommand, Guid?)

Returns a single sql command value with parameters

Task<object?> GetResultAsync(DataAccessCommand command, Guid? connectionId = null)

Parameters

command DataAccessCommand
connectionId Guid?

Returns

Task<object>

Remarks

It's used to return sql expressions commands

GetWriteProcedureScript(Element)

Build a structure script to procedure of set

string? GetWriteProcedureScript(Element element)

Parameters

element Element

Returns

string

Insert(Element, Dictionary<string, object?>)

void Insert(Element element, Dictionary<string, object?> values)

Parameters

element Element
values Dictionary<string, object>

InsertAsync(Element, Dictionary<string, object?>)

Add a record to the database. Return the id in the values ​​field as a reference

Task InsertAsync(Element element, Dictionary<string, object?> values)

Parameters

element Element

Base element with the basic structure of the table

values Dictionary<string, object>

List of values ​​to be stored in the database

Returns

Task

Remarks

How to do: [key(database field name), value(value to be stored in the database)].

SetCommandAsync(DataAccessCommand, Guid?)

Execute the command in the database.

Task SetCommandAsync(DataAccessCommand command, Guid? connectionId = null)

Parameters

command DataAccessCommand
connectionId Guid?

Returns

Task

Remarks

It's used to run scripts from data dictionary at importation files

SetCommandListAsync(IEnumerable<DataAccessCommand>, Guid?)

Task<int> SetCommandListAsync(IEnumerable<DataAccessCommand> commandList, Guid? connectionId = null)

Parameters

commandList IEnumerable<DataAccessCommand>
connectionId Guid?

Returns

Task<int>

SetValues(Element, Dictionary<string, object?>, bool)

CommandOperation SetValues(Element element, Dictionary<string, object?> values, bool ignoreResults = false)

Parameters

element Element
values Dictionary<string, object>
ignoreResults bool

Returns

CommandOperation

SetValuesAsync(Element, Dictionary<string, object?>, bool)

Set a record in the database. If it exists then update it, otherwise add. Include PK in Hashtable in case of indentity

Task<CommandOperation> SetValuesAsync(Element element, Dictionary<string, object?> values, bool ignoreResults = false)

Parameters

element Element

Base element with the basic structure of the table

values Dictionary<string, object>

List of values to be stored in the database

ignoreResults bool

By default the values returned in the set procedures are returned by reference in the hashtable values object, if this ignoreResults parameter is true this action is ignored, improving performance

Returns

Task<CommandOperation>

NONE=-1, INSERT=0, UPDATE=1, DELETE=2

Remarks

How to do: [key(database field name), value(value to be stored in the database)].

TableExists(string, Guid?)

bool TableExists(string tableName, Guid? connectionId = null)

Parameters

tableName string
connectionId Guid?

Returns

bool

TableExistsAsync(string, Guid?)

Check if table exists in the database

Task<bool> TableExistsAsync(string tableName, Guid? connectionId = null)

Parameters

tableName string
connectionId Guid?

Returns

Task<bool>

Update(Element, Dictionary<string, object?>)

int Update(Element element, Dictionary<string, object?> values)

Parameters

element Element
values Dictionary<string, object>

Returns

int

UpdateAsync(Element, Dictionary<string, object?>)

Update a record in the database

Task<int> UpdateAsync(Element element, Dictionary<string, object?> values)

Parameters

element Element
values Dictionary<string, object>

Returns

Task<int>