KLO128.D3ORM.Common
Dependencies: KLO128.D3ORM.Common.Abstract
./
D3BaseContext : ID3Context
- Proxy abstract class that contains basic props and functionality for mapping entity names and relations to be able to handle queries.
- Implements ID3Context.
namespace KLO128.D3ORM.Common
{
public abstract class D3BaseContext : ID3Context
}
D3BaseSpecification : ISpecification
- Proxy abstract class that contains basic declarations that are used and implemented in D3CoreSpecification and D3Specification.
namespace KLO128.D3ORM.Common
{
public abstract class D3BaseSpecification : ISpecification
}
D3Specification
- Helper static class that contains instantiating and building functions for D3Specifications to be used at infrastructure side...
namespace KLO128.D3ORM.Common
{
public static class D3Specification
}
# | Member Name | Return Type | Description | Default Value |
---|---|---|---|---|
prop | HelperInitialized | public | Indicates if the SpecHelper is initialized. | |
prop | SpecHelper | public | DO NOT use externally. Internal static helper used to handle this tool functions. Instantiated with ID3Context instantiation. | |
prop | ThrowWhenExpectedJoinNotSuccessful | public | Indicates if to throw an exception if a try of appending a join was not successful. True by default. | |
func | BuildSQL(..) | string | Builds and gets the SQL using the parameters for the filter. | |
func | Create<TEntity>(..) | ISpecification<TEntity> | Creates a new instance of ISpecification<TEntity>. | |
func | Create<TEntity, TParent>(..) | ISpecification<TEntity> | Creates a new instance of ISpecification<TEntity> which is prepared to be appended to a parent specification only through the propToIncludeOnly (in case of more references from a single table). | |
func | Create<TInverseRoot, TResult>(..) | ISpecification<TResult> | Creates a new instance of ISpecification<TResult> which must be on the very left side of future joining (this specification cannot be appended to some parent one). The query result should be selected as List<TResult>. The top query context is of type TInverseRoot. | |
func | PreBuild<TEntity>(..) | ISpecification<TEntity> | Prebuilds the specification in order to cache SQL part strings for building a final query. | |
func | RemoveFilterItems<TEntity, THolder>(..) | ISpecification<TEntity> | Returns a new specification with cloned filter created from that specification and removes all the filter items containing the specified filterProp. | |
func | RemoveSortItem<TEntity, THolder>(..) | ISpecification<TEntity> | Returns a new specification with cloned sort context created from that specification and removes all the sort items containing the specified sortProp. |
ID3Context
namespace KLO128.D3ORM.Common
{
public interface ID3Context
}
# | Member Name | Return Type | Description | Default Value |
---|---|---|---|---|
prop | DatabaseType | DatabaseType | The database system this context is created for. | |
prop | DateFormat | string | Database System Date Format: yyyy-MM-dd is the default value. | |
prop | DbIdColumnFormat | string | Name Format of Id Columns | |
prop | DtoPatternFormat | string | DTO pattern supporting regular expression syntax. Must contain a placeholder for an entity name: {0} | |
prop | EntityIdPropFormat | string | Name Format of Id Properties | |
prop | EntityMappings | Dictionary<Type, | The dictionary (EntityType -> EntityMapping) for a quick indexed access to EntityMapping of each type. | |
prop | EntitiesNameSpace | string | The namespace of the Entities | |
prop | ExceptionalDbColumnNames | Dictionary<string, | Defines non-standard property -> column name mappings, which cannot be guessed. I.e.: GUIDExpirationDate would be converted from camel case into MySQL or Oracle name as: g_u_i_d_expiration_date. Important also for other DbSystems using camel case names if a column or table name is not the same as a property name. | |
prop | IdefStart | char | The start identifier character, typically for MySQL: ` or for MSSQL, SQLite: [ | | | **prop** | **IdefEnd** | `char` | The end identifier character, typically for MySQL: ` or for MSSQL, SQLite: ] | |
prop | NotEqualOperator | string | The target database not equal operator string - it differs across database systems: != or <> | |
prop | NotFunction | string? | Specifies NOT(condition) function name. If null then (condition) = 0 is used. | |
prop | OtherModelNamespaces | public | Defines other namespaces (other than query root's namespace) where to find entity or DTO. | |
prop | UseAutoIncrement | bool | Indicates if to skip populating of an id primary key property (if it is populated by itself in the database using the auto-increment principle). | |
prop | UseFullIdOrderBy | bool | Indicates if to include all primary keys into ORDER BY expression even if there are no other "many to one" or one-to-many sorts from a current one-to-many context select group till the end of the select. | |
func | ConcatDbName(..) | string | Concatenates the text (usual usage: asPrefix == true) to the database dbName with persistence of naming conventions and identifier start-end quotes. | |
func | ConvertsDbValue(..) | object? | Converts the database value into the target propertyType. | |
func | CreateAnonymousConnection(..) | IDbConnecttion | Creates an anonymous connection outside of any IoC container - useful for asynchronous bulk operations, which needs to continue even if request ends. | |
func | GetDbNameQuoted(..) | string | Gets a database name from the name including IdefStart and IdefEnd chars. | |
func | GetEntityNameFromDTO(..) | string? | Gets the entity name from the dtoName. | |
func | GetIdPropName(..) | string | Gets the id property name from the entityName. | |
func | GetLastInsertedRowIdCommandText(..) | string | Retrieves a database script for obtaining the last inserted row id. | |
func | IsEntityIdProp(..) | bool | Determines if the propName is an id like property name. | |
func | TryGetEntityNameFromIdProp(..) | string? | If the propName is id like, returns its entity name, otherwise returns null. |
./Extensions
Data Reading Extensions
namespace KLO128.D3ORM.Common.Extensions
{
public static class DataReadingExtensions
}
# | Member Name | Return Type | Description | Default Value |
---|---|---|---|---|
func | AggCompute<TEntityOrDTO, TResult>(..) | List<TResult> | Executes computing aggregation functions according to the cmdBatch. (2 commands are generated from a specification if the skip and take option is used.) Returns a list of TResult containing the property names and the structure specified by the cmdBatch. | |
func | AggCompute<TResult>(..) | List<TResult> | Executes computing aggregation functions according to the sqlAdapter. Returns a list of TResult containing the property names and the structure specified by the sqlAdapter. | |
func | AggSelect<TEntityOrDTO, TResult>(..) | List<TResult> | Queries the database by the cmdBatch. (2 commands are generated from a specification if the skip and take option is used.) Returns a full object tree (aggregated) list of TResult as a result. | |
func | AggSelect<TResult>(..) | List<TResult> | Queries the database by the sqlAdapter. Returns a full object tree (aggregated) list of TResult as a result. |
DbConnection Extensions
namespace KLO128.D3ORM.Common.Extensions
{
public static class DbConectionExtensions
}
# | Member Name | Return Type | Description | Default Value |
---|---|---|---|---|
func | AttachTransaction | void | Attaches connection's transaction to the cmd if accessible. MSSQL requires it. | |
func | ExecuteCommand | void | Opens the connection if not opened, creates a non-query command using cmdText and pars, executes the command and disposes the command. | |
func | ExecuteDbStoredCommand | void | Executes a command as a stored procedure using cmdText and parameters. The connection is opened if not have been and the command is disposed after finishing the work. | |
func | OpenIfNot | void | Opens the connection if not opened. |
./Impl
- Contains internal helpers and implementations of repositories, specifications and base logic of D3Contexts...
namespace KLO128.D3ORM.Common.Impl
{
public class D3SpecificationWithParams<TEntity> : D3SpecificationWithParams, ISpecification<TEntity>, ISpecificationWithParams<TEntity> where TEntity : class
{
}
public abstract class D3SpecificationWithParams
{
}
public class D3Specification<TEntity> : D3CoreSpecification, ISpecification<TEntity> where TEntity : class
{
}
public abstract class D3CoreSpecification : D3BaseSpecification
{
}
public class D3AggRootRepository<TEntity> : D3CommonRepository<TEntity>, IAggRootRepository<TEntity> where TEntity : class, new()
{
}
public class D3CommonRepository<TEntity> : ICommonRepository<TEntity> where TEntity : class, new()
{
}
...
}
./Impl.Extensions
- Contains internal extension utilities and also public functions for retrieving CRUD scripts used in the repositories.
namespace KLO128.D3ORM.Common.Impl.Extensions
{
public static class D3QueryHelper
{
public static string FindByIdQuery<TId>(this ID3Context d3Context, EntityMapping entityMap, TId id);
public static string? GetBulkUpdateScript<TEntity>(this ID3Context d3Context, ISpecification<TEntity> specification, params Tuple<LambdaExpression, object?>[] propValues) where TEntity : class, new();
public static string? GetBulkDeleteScript<TEntity>(this ID3Context d3Context, ISpecification<TEntity> specification) where TEntity : class, new();
public static string? GetDeleteScript<TEntity>(this ID3Context d3Context, TEntity entity);
public static string? GetInsertScript<TEntity>(this ID3Context d3Context, TEntity entity);
public static string? GetUpdateScript<TEntity>(this ID3Context d3Context, TEntity entity);
public static string? GetUpdateScript<TEntity>(this ID3Context d3Context, TEntity entity, bool setValues, Tuple<LambdaExpression, object?>[] propValues);
...
}
...
}
./Models
Operator
namespace KLO128.D3ORM.Common.Models
{
public enum Operator
}
# | 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 | |
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). | |
AndDuplicitAnd = 16 | 64 | ||
AndDuplicitOr = 16 | 128 | ||
OrDuplicitOr = 32 | 128 | ||
OrDuplicitAnd = 32 | 64 |