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
Elementrelationships
List<RelationshipReference>
CreateDataModelAsync(Element, List<RelationshipReference>?)
Create an element's tables and procedures
Task CreateDataModelAsync(Element element, List<RelationshipReference>? relationships = null)
Parameters
element
Elementrelationships
List<RelationshipReference>
Returns
Delete(Element, Dictionary<string, object>)
int Delete(Element element, Dictionary<string, object> primaryKeys)
Parameters
element
ElementprimaryKeys
Dictionary<string, object>
Returns
DeleteAsync(Element, Dictionary<string, object>)
Delete records based on filter.
Task<int> DeleteAsync(Element element, Dictionary<string, object> primaryKeys)
Parameters
element
ElementprimaryKeys
Dictionary<string, object>
Returns
ExecuteBatchAsync(string, Guid?)
Task<bool> ExecuteBatchAsync(string script, Guid? connectionId = null)
Parameters
Returns
GetAlterTableScriptAsync(Element)
Task<string?> GetAlterTableScriptAsync(Element element)
Parameters
element
Element
Returns
GetCount(Element, Dictionary<string, object?>)
int GetCount(Element element, Dictionary<string, object?> filters)
Parameters
element
Elementfilters
Dictionary<string, object>
Returns
GetCountAsync(Element, Dictionary<string, object?>)
Task<int> GetCountAsync(Element element, Dictionary<string, object?> filters)
Parameters
element
Elementfilters
Dictionary<string, object>
Returns
GetCreateTableScript(Element, List<RelationshipReference>?)
Build a structure script to create table
string GetCreateTableScript(Element element, List<RelationshipReference>? relationships = null)
Parameters
element
Elementrelationships
List<RelationshipReference>
Returns
GetDataSet(DataAccessCommand, Guid?)
DataSet GetDataSet(DataAccessCommand command, Guid? connectionId = null)
Parameters
command
DataAccessCommandconnectionId
Guid?
Returns
GetDataSetAsync(DataAccessCommand, Guid?, CancellationToken)
Task<DataSet> GetDataSetAsync(DataAccessCommand command, Guid? connectionId = null, CancellationToken cancellationToken = default)
Parameters
command
DataAccessCommandconnectionId
Guid?cancellationToken
CancellationToken
Returns
GetDataTable(DataAccessCommand, Guid?)
DataTable GetDataTable(DataAccessCommand dataAccessCommand, Guid? connectionId = null)
Parameters
dataAccessCommand
DataAccessCommandconnectionId
Guid?
Returns
GetDataTableAsync(DataAccessCommand, Guid?)
Task<DataTable> GetDataTableAsync(DataAccessCommand dataAccessCommand, Guid? connectionId = null)
Parameters
dataAccessCommand
DataAccessCommandconnectionId
Guid?
Returns
GetDataTableAsync(Element, EntityParameters?)
Task<DataTable> GetDataTableAsync(Element element, EntityParameters? entityParameters = null)
Parameters
element
ElemententityParameters
EntityParameters
Returns
GetDictionaryList(Element, EntityParameters?)
List<Dictionary<string, object?>> GetDictionaryList(Element element, EntityParameters? parameters = null)
Parameters
element
Elementparameters
EntityParameters
Returns
GetDictionaryListAsync(DataAccessCommand, Guid?)
Task<List<Dictionary<string, object?>>> GetDictionaryListAsync(DataAccessCommand command, Guid? connectionId = null)
Parameters
command
DataAccessCommandconnectionId
Guid?
Returns
- Task<List<Dictionary<string, object>>>
GetDictionaryListAsync(Element, EntityParameters?)
Task<List<Dictionary<string, object?>>> GetDictionaryListAsync(Element element, EntityParameters? parameters = null)
Parameters
element
Elementparameters
EntityParameters
Returns
- Task<List<Dictionary<string, object>>>
GetDictionaryListResult(Element, EntityParameters?, bool)
DictionaryListResult GetDictionaryListResult(Element element, EntityParameters? parameters = null, bool recoverTotalOfRecords = true)
Parameters
element
Elementparameters
EntityParametersrecoverTotalOfRecords
bool
Returns
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
Elementparameters
EntityParametersrecoverTotalOfRecords
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
Returns
GetFields(DataAccessCommand, Guid?)
Dictionary<string, object?> GetFields(DataAccessCommand command, Guid? connectionId = null)
Parameters
command
DataAccessCommandconnectionId
Guid?
Returns
GetFields(Element, Dictionary<string, object>)
Dictionary<string, object?> GetFields(Element element, Dictionary<string, object> primaryKeys)
Parameters
element
ElementprimaryKeys
Dictionary<string, object>
Returns
GetFieldsAsync(DataAccessCommand, Guid?)
Task<Dictionary<string, object?>> GetFieldsAsync(DataAccessCommand command, Guid? connectionId = null)
Parameters
command
DataAccessCommandconnectionId
Guid?
Returns
GetFieldsAsync(Element, Dictionary<string, object>)
Task<Dictionary<string, object?>> GetFieldsAsync(Element element, Dictionary<string, object> primaryKeys)
Parameters
element
ElementprimaryKeys
Dictionary<string, object>
Returns
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
ElementStructure basic from a table
parameters
EntityParametersshowLogInfo
boolRecords detailed log of each operation
delimiter
stringField 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
GetResultAsync(DataAccessCommand, Guid?)
Returns a single sql command value with parameters
Task<object?> GetResultAsync(DataAccessCommand command, Guid? connectionId = null)
Parameters
command
DataAccessCommandconnectionId
Guid?
Returns
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
Insert(Element, Dictionary<string, object?>)
void Insert(Element element, Dictionary<string, object?> values)
Parameters
element
Elementvalues
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
ElementBase element with the basic structure of the table
values
Dictionary<string, object>List of values to be stored in the database
Returns
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
DataAccessCommandconnectionId
Guid?
Returns
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
SetValues(Element, Dictionary<string, object?>, bool)
CommandOperation SetValues(Element element, Dictionary<string, object?> values, bool ignoreResults = false)
Parameters
element
Elementvalues
Dictionary<string, object>ignoreResults
bool
Returns
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
ElementBase element with the basic structure of the table
values
Dictionary<string, object>List of values to be stored in the database
ignoreResults
boolBy 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
Returns
TableExistsAsync(string, Guid?)
Check if table exists in the database
Task<bool> TableExistsAsync(string tableName, Guid? connectionId = null)
Parameters
Returns
Update(Element, Dictionary<string, object?>)
int Update(Element element, Dictionary<string, object?> values)
Parameters
element
Elementvalues
Dictionary<string, object>
Returns
UpdateAsync(Element, Dictionary<string, object?>)
Update a record in the database
Task<int> UpdateAsync(Element element, Dictionary<string, object?> values)
Parameters
element
Elementvalues
Dictionary<string, object>