Search Results for

    Show / Hide Table of Contents

    Class SqlRepositoryBase<TId, TModel>

    Sql repository base implementation

    Inheritance
    System.Object
    SqlRepositoryBase<TId, TModel>
    Implements
    IRepositoryBase<TId, TModel>
    IModelIdentity<TId, TModel>
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Simplic.Data.Sql
    Assembly: Simplic.Data.Sql.dll
    Syntax
    public abstract class SqlRepositoryBase<TId, TModel> : IRepositoryBase<TId, TModel>, IModelIdentity<TId, TModel>
    Type Parameters
    Name Description
    TId

    Id

    TModel

    Model

    Constructors

    | Improve this Doc View Source

    SqlRepositoryBase(ISqlService, ISqlColumnService, ICacheService)

    Initialize sql service

    Declaration
    public SqlRepositoryBase(ISqlService sqlService, ISqlColumnService sqlColumnService, ICacheService cacheService)
    Parameters
    Type Name Description
    ISqlService sqlService

    Sql service

    ISqlColumnService sqlColumnService

    Sql column service

    ICacheService cacheService

    Cache service

    Properties

    | Improve this Doc View Source

    DifferentColumnNames

    Gets a list of different column names

    Declaration
    public virtual IDictionary<string, string> DifferentColumnNames { get; }
    Property Value
    Type Description
    System.Collections.Generic.IDictionary<System.String, System.String>
    | Improve this Doc View Source

    PrimaryKeyColumn

    Gets the current primary column name

    Declaration
    public abstract string PrimaryKeyColumn { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    TableName

    Gets the current table name

    Declaration
    public abstract string TableName { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    UseCache

    Gets or sets whether to use the cache

    Declaration
    public virtual bool UseCache { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Delete(TId)

    Delete data by id

    Declaration
    public virtual bool Delete(TId id)
    Parameters
    Type Name Description
    TId id

    Id of an object to delete

    Returns
    Type Description
    System.Boolean

    True if successful

    | Improve this Doc View Source

    Delete(TModel)

    Delete data

    Declaration
    public virtual bool Delete(TModel obj)
    Parameters
    Type Name Description
    TModel obj

    Object to delete

    Returns
    Type Description
    System.Boolean

    True if successful

    | Improve this Doc View Source

    Get(TId)

    Get data by id

    Declaration
    public virtual TModel Get(TId id)
    Parameters
    Type Name Description
    TId id

    Id

    Returns
    Type Description
    TModel

    Instance of TModel if exists

    | Improve this Doc View Source

    GetAll()

    Get all objects

    Declaration
    public virtual IEnumerable<TModel> GetAll()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<TModel>

    Enumerable of TModel.

    | Improve this Doc View Source

    GetAllByColumn<T>(String, T)

    Get all objects where a given column value match

    Declaration
    protected virtual IEnumerable<TModel> GetAllByColumn<T>(string columnName, T id)
    Parameters
    Type Name Description
    System.String columnName
    T id
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<TModel>

    Enumerable of TModel

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    GetByColumn<T>(String, T)

    Get a model instance from the database, using a custom column name

    Declaration
    protected virtual TModel GetByColumn<T>(string columnName, T id)
    Parameters
    Type Name Description
    System.String columnName

    Column name

    T id

    Id value

    Returns
    Type Description
    TModel

    Model if exists

    Type Parameters
    Name Description
    T

    Id type

    | Improve this Doc View Source

    GetConnection()

    Gets the connection name

    Declaration
    public string GetConnection()
    Returns
    Type Description
    System.String

    connection name

    | Improve this Doc View Source

    GetId(TModel)

    Gets the id of a model

    Declaration
    public abstract TId GetId(TModel obj)
    Parameters
    Type Name Description
    TModel obj

    Model to get the id of

    Returns
    Type Description
    TId

    Id value

    | Improve this Doc View Source

    Save(TModel)

    Create or update data

    Declaration
    public virtual bool Save(TModel obj)
    Parameters
    Type Name Description
    TModel obj

    Object to save

    Returns
    Type Description
    System.Boolean

    True if successful

    Implements

    IRepositoryBase<TId, TModel>
    IModelIdentity<TId, TModel>
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2018 SIMPLIC GmbH
    Generated by DocFx