Show / Hide Table of Contents

    Interface IModelMapper

    Interface, which describe class for mapping database to model.

    Namespace: Kros.KORM.Metadata
    Assembly: Kros.KORM.dll
    Syntax
    public interface IModelMapper

    Properties

    MapColumnName

    Gets or sets the column name mapping logic.

    Declaration
    Func<ColumnInfo, Type, string> MapColumnName { get; set; }
    Property Value
    Type Description
    System.Func<ColumnInfo, System.Type, System.String>
    Remarks

    Params: ColumnInfo - info about column. Type - Type of model. string - return column name.

    MapPrimaryKey

    Gets or sets the primary key mapping logic.

    Declaration
    Func<TableInfo, IEnumerable<ColumnInfo>> MapPrimaryKey { get; set; }
    Property Value
    Type Description
    System.Func<TableInfo, System.Collections.Generic.IEnumerable<ColumnInfo>>

    MapTableName

    Gets or sets the table name mapping logic.

    Declaration
    Func<TableInfo, Type, string> MapTableName { get; set; }
    Property Value
    Type Description
    System.Func<TableInfo, System.Type, System.String>
    Remarks

    Params: TableInfo - info about table. Type - Type of model. string - return table name.

    Methods

    GetInjector<T>()

    Get property service injector.

    Declaration
    IInjector GetInjector<T>()
    Returns
    Type Description
    IInjector

    Service property injector.

    Type Parameters
    Name Description
    T

    Model type.

    GetTableInfo(Type)

    Gets the table information.

    Declaration
    TableInfo GetTableInfo(Type modelType)
    Parameters
    Type Name Description
    System.Type modelType

    Type of the model.

    Returns
    Type Description
    TableInfo

    Table info.

    GetTableInfo<T>()

    Gets the table information.

    Declaration
    TableInfo GetTableInfo<T>()
    Returns
    Type Description
    TableInfo

    Table info.

    Type Parameters
    Name Description
    T

    Type of model.

    InjectionConfigurator<T>()

    Get property injection configuration for model T.

    Declaration
    IInjectionConfigurator<T> InjectionConfigurator<T>()
    Returns
    Type Description
    IInjectionConfigurator<T>
    Type Parameters
    Name Description
    T
    Examples
                Database.DefaultModelMapper
                .InjectionConfigurator<Person>()
                    .FillProperty(p => p.CalculationService, () => new CalculationService())
                    .FillProperty(p => p.Logger, () => ServiceContainer.Instance.Resolve<ILogger>());

    SetColumnName<TModel, TValue>(Expression<Func<TModel, TValue>>, String)

    Set column name for specific property.

    Declaration
    void SetColumnName<TModel, TValue>(Expression<Func<TModel, TValue>> modelProperty, string columnName)
    
        where TModel : class
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<TModel, TValue>> modelProperty

    Expression for defined property to.

    System.String columnName

    Database column name.

    Type Parameters
    Name Description
    TModel
    TValue
    Examples
                Database.DefaultModelMapper.SetColumnName<Person, string>(p => p.Name, "FirstName");
    Back to top KROS a.s.