KLO128.D3ORM.Common.Abstract

Dependencies: None

  • Contains general items that can be referenced from any library even if you have transfered your solution to a NoSQL database. 
  • Contains interfacescore models needed for the interfaces and DTO Extensions
  • Visit each item for detailed information. 

DTO Extensions


namespace KLO128.D3ORM.Common.Abstract
{
    public static class DtoExtensions
}

# Member Name Return Type Description Default Value
funcobject. ToDTO<TDTO>()TDTOExtension for object: Converts an object into TDTOThe values of the properties with the same name (or id like name) belonging to the object are set into the target TDTO instance properties.

If you want to get a DTO list directly from a database, follow the link: DTO Query Building

 

IAggRootRepository<TEntity>  : ICommonRepository<TEntity>


namespace KLO128.D3ORM.Common.Abstract
{
    public interface IAggRootRepository<TEntity> : ICommonRepository<TEntity> where TEntity : class
}

# Member Name Return Type Description Default Value
funcAddForSQLOnly(..)voidAdds the root entity instance into the database and ignores children adds.
funcAddRoot(..)voidAdds the root entity instance into the database.
funcDeleteRoot(..)voidDeletes the root entity instance from the database.
funcUpdateRootForSQLOnly(..)voidUpdates the root entity instance only (without effect of children). Not usable for NoSQL databases, where you update whole JSON context, document, or nothing.

ICommonRepository<TEntity> 


namespace KLO128.D3ORM.Common.Abstract
{
    public interface ICommonRepository<TEntity> where TEntity : class
}

# Member Name Return Type Description Default Value
funcAddAsChild<TParent>(..)voidAdds the child entity instance to the database and to its parentcollection instance (assignment to the prop) ("one to many" relation).
funcAddAsChild<TParent>(..)voidAdds the child entity instance to the database and to its parent instance (assignment to the prop) ("many to one" relation).
funcBulkDelete(..)voidCalls BulkDeleteAsync() and waits for a certain of time specified by the delayAfterTaskStart to avoid disposing of the repository before an anonymous connection is created.
funcBulkDeleteAsync(..)TaskDeletes all the rows given from the specification query asynchronously. An anonymous connection is created, so it will finish the job even if the request lifetime and all its services' lifetimes are over.
funcBulkUpdateAsync(..)TaskUpdates all the rows given from the specification query asynchronously. An anonymous connection is created, so it will finish the job even if the request lifetime and all its services' lifetimes are over.
funcCountAvgMinMaxSum(..)List<object>Computes COUNT, AVG, MIN, MAX, SUM aggregate functions according to the specification
funcCountAvgMinMaxSum<TResultDto>(..)List<TResultDto>Computes COUNT, AVG, MIN, MAX, SUM aggregate functions according to the specification
funcCountRows(..)intReturns the number of rows of the top TEntity instance (without aggregation duplicities) in the query defined by the specification
funcDeleteFromParent<TParent>(..)voidDeletes the child entity instance from the database and from its parent collection instance (removes the entity item from the prop) ("one to many" relation).
funcDeleteFromParent<TParent>(..)voidDeletes the child entity instance from the database and from its parent instance (the prop is set to null) ("many to one" relation).
funcExecuteNonQueryCommand(..)voidFormats parameters (if defined) and executes a non-query command...
funcExecuteNonQueryStoredProcedure(..)voidExecutes a non-query stored procedure...
funcExecuteStoredCompute<TResult>(..)List<TResult>Executes a stored procedure query containing computing aggregate functions: COUNT, AVG, MIN, MAX, SUM. (Aggregation is possible if the correct column names are used.)
funcExecuteStoredSelect(..)List<TEntity>Executes and maps a stored procedure query result to an aggregated list of TEntity(Aggregation is possible if the correct column names are used.)
funcExecuteStoredSelect<TResultDto>(..)List<TResultDto>Executes and maps a stored procedure query result to an aggregated list of TResultDto(Aggregation is possible if the correct column names are used.)
funcFindBy(..)TEntity?Queries the database by the specification and returns a single full object tree (aggregated) instance or null.
funcFindBy<TResultDto>(..)TResultDto?Queries the database by the specification and returns a single full object tree (aggregated) instance or null.
funcFindByIdSingle<TId>(..)TEntity?Tries to find the row of type TEntity by id and returns an entity without any child aggregations (single row containing primitive type values only) or null.
funcFindManyBy(..)List<TEntity>Queries the database by the specification and returns a full object tree (aggregated) list of TEntity as a result.
funcFindManyBy(..)List<TEntity>Queries the database by the specification and returns a full object tree (aggregated) list of TEntity as a result. Optionally, you can specify the number of top entity rows to skip and the number of top entity rows to take (included in a query result).
funcFindManyBy<TResultDto>(..)List<TResultDto>Queries the database by the specification and returns a full object tree (aggregated) list of TResultDto as a result.
funcFindManyBy<TResultDto>(..)List<TResultDto>Queries the database by the specification and returns a full object tree (aggregated) list of TResultDto as a result. Optionally, you can specify the number of top entity rows to skip and the number of top entity rows to take (included in a query result).
funcParameterizedInsert<TREsultDto>(..)voidQuick insert using the same parameterized command.
funcSaveChanges()voidFunction for ORMs that tracks the database context state (D3ORM does nothing).
funcUpdateEntity(..)voidUpdates the whole single entity instance only (without any touch of any aggregation).
funcUpdateProperties(..)voidUpdates the specified properties of the entity instance by using the expression(s) (without any touch of any aggregation).

ISpecification


namespace KLO128.D3ORM.Common.Abstract
{
    public interface ISpecification
}

# Member Name Return Type Description Default Value
propDtoTypeType?DTO type of the top entity or NULL.
propEntityTypeTypeThe type of the top query entity.
propInnerContextIdintThe Id of an inner context (IN/NOT_IN) expression. The default value is 0. All contexts of the query can be specified as -1.
propThrowExceptionIfEmptyFilterboolIndicates if to throw an exception if the specification's filter contains no items. The default value is true for D3BaseSpecification

ISpecification<TEntity>  : ISpecification


namespace KLO128.D3ORM.Common.Abstract
{
    public interface ISpecification<TEntity> : ISpecification where TEntity : class
}

# Member Name Return Type Description Default Value
propPreBuiltboolIndicates if this specification has been prebuilt (if PreBuild() has been called).
funcAnd(..)ISpecification<TEntity>Returns a clone of this specification concatenated with the specification by logical AND. If this or that expression consists of 2 or more top context logical OR expressions then the expression is covered by parentheses.
funcAsDTO<TDTO>(..)ISpecification<TDTO>Returns a new specification from this specification applying DTO mapping of the query result. Properties of DTO could be omitted. In case of using D3ORM, Id property names do not have to be defined in the propsbut must remain the same or should follow the id property pattern with the DTO name instead of the entity name. In case of renaming properties, specify the property name mappings by the props parameter.
funcAvg(..)ISpecification<TEntity>Clones this specification and computes the average value upon each of the IComparableproperties
funcAvgChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the average value upon each of the IComparableproperties belonging to the parentProp
funcAvgChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the average value upon each of the IComparableproperties belonging to the parentProp
funcCompare<TChild, TProp>(..)ISpecification<TEntity>Returns a clone of this specification. Appends a new instance of FilterContext (or new instances if directParentNavigationProp is not specified as a unique navigation parent property) using the propthe operator op and the valueThe filter is appended to an existing context according to the appendWithOp parameter.
funcCompare<TProp>(..)ISpecification<TEntity>Returns a clone of this specification. Appends a new instance of FilterContext using the propthe operator op and the valueThe filter is appended to an existing context according to the appendWithOp parameter.
funcCompareFormat<TChild>(..)ISpecification<TEntity>Returns a clone of this specification and appends a new instance of FilterContext (or new instances if directParentNavigationProp is not specified as a unique navigation parent property) using the prop specified and the operator op and also sets the string value format according to placeholderIdxIf the value of placeholderIdx is used for a different property, then throws an error.
funcCompareFormat(..)ISpecification<TEntity>Returns a clone of this specification and appends new instance(s) of FilterContext using the prop specified and the operator op and also sets the value format according to placeholderIdxIf the value of placeholderIdx is used for a different property, then throws an error.
funcCount(..)ISpecification<TEntity>Clones this specification and computes the number of rows upon each property from properties separately with the value of the IComparable
funcCountChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the number of rows upon each property from properties separately, belonging to the parentPropwith the value of the IComparable
funcCountChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the number of rows upon each property from properties separately, belonging to the parentPropwith the value of the IComparable
funcCountRows()intReturns a clone of the current specification that generates counting query of root TEntity rows instead of selecting that rows.
funcCustomAggFunc(..)ISpecification<TEntity>Clones this specification, computes cross column custom operations and optionally applies a constant and (or) an aggregation function on the result.
funcCustomChildAggFunc<TParent, TChild>(..)ISpecification<TEntity>Clones this specification, computes cross column custom operations and optionally applies a constant and (or) an aggregation function on the result.
funcCustomChildAggFunc<TParent, TChild>(..)ISpecification<TEntity>Clones this specification, computes cross column custom operations and optionally applies a constant and (or) an aggregation function on the result.
funcExcludeSelectPropMasks(..)ISpecification<TEntity>Returns a clone of this specification and removes all sensitive properties from the query specified by the excludePropNamePatterns
funcIn(..)ISpecification<TEntity>Returns a clone of this specification that satisfies the ComparisonOp.IN filter applied on the specification accessed only from the leftSideFilterProp
funcIn(..)ISpecification<TEntity>Returns a clone of this specification that satisfies the ComparisonOp.IN filter applied on the specification
funcIn<TChild, TProp>(..)ISpecification<TEntity>Returns a clone of this specification and appends the prop and the array with the ComparisonOp.IN operator only for the prop accessed from the directParentNavigationProp
funcIn<TProp>(..)ISpecification<TEntity>Returns a clone of this specification and appends the prop and the array with the ComparisonOp.IN operator.
funcIncludeSelectProps<TAgg>(..)ISpecification<TEntity>Returns a clone of this specification and specifies which properties to include in the aggregate result (ExcludeSelectPropMasks() has higher priority). If you want to include all, just use: (TAgg x) => "*"Id property is included automatically if you include at least one property of an entity which the property belongs to.
funcInFormat<TChild>(..)ISpecification<TEntity>Returns a clone of this specification and appends the prop and the placeholderIdx with the ComparisonOp.IN operator only for the prop accessed from the directParentNavigationProp(The placeholderIdx must be substituted by an array.)
funcInFormat(..)ISpecification<TEntity>Returns a clone of this specification and appends the prop and the placeholderIdx with the ComparisonOp.IN operator. (The placeholderIdx must be substituted by an array.)
funcMin(..)ISpecification<TEntity>Clones this specification and computes the minimal value upon each of the IComparableproperties
funcMinChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the minimal value upon each of the IComparableproperties belonging to the parentProp
funcMinChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the minimal value upon each of the IComparableproperties belonging to the parentProp
funcMax(..)ISpecification<TEntity>Clones this specification and computes the maximal value upon each of the IComparableproperties
funcMaxChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the maximal value upon each of the IComparableproperties belonging to the parentProp
funcMaxChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the maximal value upon each of the IComparableproperties belonging to the parentProp
funcNot()ISpecification<TEntity>Returns a clone of this specification with a negated filter expression.
funcNotIn(..)ISpecification<TEntity>Returns a clone of this specification that satisfies the ComparisonOp.NOT_IN filter applied on the specification accessed only from the leftSideFilterProp
funcNotIn(..)ISpecification<TEntity>Returns a clone of this specification that satisfies the ComparisonOp.NOT_IN filter applied on the specification
funcNotIn<TChild, TProp>(..)ISpecification<TEntity>Returns a clone of this specification and appends the prop and the array with the ComparisonOp.NOT_IN operator only for the prop accessed from the directParentNavigationProp
funcNotIn<TProp>(..)ISpecification<TEntity>Returns a clone of this specification and appends the prop and the array with the ComparisonOp.NOT_IN operator.
funcNotInFormat<TChild>(..)ISpecification<TEntity>Returns a clone of this specification and appends the prop and the placeholderIdx with the ComparisonOp.NOT_IN operator only for the prop accessed from the directParentNavigationProp(The placeholderIdx must be substituted by an array.)
funcNotInFormat(..)ISpecification<TEntity>Returns a clone of this specification and appends the prop and the placeholderIdx with the ComparisonOp.NOT_IN operator. (The placeholderIdx must be substituted by an array.)
funcOr(..)ISpecification<TEntity>Returns a clone of this specification concatenated with the specification by logical OR. If this or that expression consists of 2 or more top context logical AND expressions then the expression is covered by parentheses.
funcOrderBy<TChild>(..)ISpecification<TEntity>Returns a clone of this specification and sorts the result list according to the prop accessed only from the directParentNavigationProp
funcOrderBy(..)ISpecification<TEntity>Returns a clone of this specification and sorts the result list according to the prop
funcSum(..)ISpecification<TEntity>Clones this specification and computes the sum value upon each of the IComparableproperties
funcSumChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the sum value upon each of the IComparableproperties belonging to the parentProp
funcSumChild<TParent, TChild>(..)ISpecification<TEntity>Clones this specification and computes the sum value upon each of the IComparableproperties belonging to the parentProp
funcUnion(..)ISpecification<TEntity>Clones this specification and merges it with the specification which has to have the same number of columns and the same column types. Unions from a deeper context are forgotten!

ISpecificationWithParams : ISpecification


namespace KLO128.D3ORM.Common.Abstract
{
    public interface ISpecificationWithParams : ISpecification
}

# Member Name Return Type Description Default Value
propParametersIDictionary<int, object?>Filter Parameters

ISpecificationWithParams<TEntity>  : ISpecification<TEntity>, ISpecificationWithParams


namespace KLO128.D3ORM.Common.Abstract
{
    public interface ISpecificationWithParams<TEntity> : ISpecification<TEntity>, ISpecificationWithParams where TEntity : class
}

# Member Name Return Type Description Default Value

ComparisonOp


namespace KLO128.D3ORM.Common.Abstract
{
    public enum ComparisonOp
}

# Member Name Description
NONE = 0 No Operator
IN = 1 Item IN Collection or IN Selection Operator
NOT_IN = 2 Item NOT IN Collection or NOT IN Selection Operator
EQUALS = 3 '=' Operator
NOTEQUAL = 4 '!=' or '<>' Operator (Depends on database system.)
GREATER_THAN = 5 '>' Operator
LESS_THAN = 6 '<' Operator
GREATER_THAN_OR_EQUAL = 7 '>=' Operator
LESS_THAN_OR_EQUAL = 18 '<=' Operator
LIKE = 9 LIKE Operator
NOT_LIKE = 10 NOT LIKE Operator

ComputeType


namespace KLO128.D3ORM.Common.Abstract
{
    public enum ComputeType
}

# Member Name Description
NONE = 0 No Function
Count = 1 Count(prop) Function
Avg = 2 Average(integerProp) Function
Min = 3 Minimum(prop) Function
Max = 4 Maximum(prop) Function
Sum = 5 SUM(integerProp) Function

CrossColumnOp


namespace KLO128.D3ORM.Common.Abstract
{
    public enum ComputeType
}

# Member Name Description
DiffOrNone = 0 PreviousResult - CurrentColumn or NONE
Avg = 2 ( PreviousResult + CurrentColumn ) / 2
Sum = 5 PreviousResult + CurrentColumn
Multiple = 6 PreviousResult * CurrentColumn
Divide = 7 PreviousResult / CurrentColumn
Modulo = 8 PreviousResult mod CurrentColumn
CaseWhenThenElse = 16 CASE WHEN ColumnX op ColumnY THEN CaseWhenThenResult ELSE CaseWhenElseResult END;
CaseWhenThenElseEquals = 17 CASE WHEN ColumnX = ColumnY THEN CaseWhenThenResult ELSE CaseWhenElseResult END;
CaseWhenThenElseGreaterThan = 18 CASE WHEN ColumnX > ColumnY THEN CaseWhenThenResult ELSE CaseWhenElseResult END;
CaseWhenThenElseLessThan = 20 CASE WHEN ColumnX < ColumnY THEN CaseWhenThenResult ELSE CaseWhenElseResult END;
CaseWhenThenElseGreaterThanOrEquals = 19 CASE WHEN ColumnX >= ColumnY THEN CaseWhenThenResult ELSE CaseWhenElseResult END;
CaseWhenThenElseLessThanOrEquals = 21 CASE WHEN ColumnX <= ColumnY THEN CaseWhenThenResult ELSE CaseWhenElseResult END;

LogicalOp


namespace KLO128.D3ORM.Common.Abstract
{
    public enum LogicalOp
}

# Member Name Description
NONE = 0 No Operator
AND = 16 Logical AND Operator
OR = 32 Logical OR Operator
DuplicitAnd = 64 Duplicit references will be appended by the AND operator (OR is default).
DuplicitOr = 128 Duplicit references will be appended by the OR operator - this is the default option (if no other duplicit operator set).

SerializableProperty


namespace KLO128.D3ORM.Common.Abstract
{
    public class SerializableProperty
}

# Member Name Return Type Description Default Value
propNamestring Property Name
propPropertyTypeType Property Type
propDeclaringTypeType Declaring Type
ctorSerializableProperty()SerializableProperty Constructor
ctorSerializableProperty(..)SerializableProperty Constructor
oper==bool Operator Equals
oper!=bool Operator Not Equals
funcEquals(..)bool Returns true if types and name are the same.
funcGetHashCode(..)bool
funcGetPropertyInfo(..)PropertyInfo? Gets the PropertyInfo