示例#1
0
 /// <summary>
 /// Creates a new instance of <see cref="BaseRepository{TEntity, TDbConnection}"/> class.
 /// </summary>
 /// <param name="connectionString">The connection string to be used by this repository.</param>
 /// <param name="connectionPersistency">
 /// The database connection persistency type. Setting to <see cref="ConnectionPersistency.Instance"/> will make the repository re-used a single connection all throughout its lifespan. Setting
 /// to <see cref="ConnectionPersistency.PerCall"/> will create a new connection object on every repository call.
 /// </param>
 public BaseRepository(string connectionString,
                       ConnectionPersistency connectionPersistency)
     : this(connectionString,
            null,
            connectionPersistency,
            null,
            Constant.DefaultCacheItemExpirationInMinutes,
            null,
            null)
 {
 }
示例#2
0
 /// <summary>
 /// Creates a new instance of <see cref="BaseRepository{TEntity, TDbConnection}"/> object.
 /// </summary>
 /// <param name="connectionString">The connection string to be used by this repository.</param>
 /// <param name="commandTimeout">The command timeout in seconds to be used on every operation by this repository.</param>
 /// <param name="cache">The cache object to be used by this repository. This object must implement the <see cref="ICache"/> interface.</param>
 /// <param name="cacheItemExpiration">The expiration in minutes of the cache item.</param>
 /// <param name="trace">The trace object to be used by this repository. This object must implement the <see cref="ITrace"/> interface.</param>
 /// <param name="statementBuilder">The SQL statement builder object to be used by this repository. This object must implement the <see cref="ITrace"/> interface.</param>
 /// <param name="connectionPersistency">
 /// The database connection persistency type. Setting to <see cref="ConnectionPersistency.Instance"/> will make the repository re-used a single connection all throughout its lifespan. Setting
 /// to <see cref="ConnectionPersistency.PerCall"/> will create a new connection object on every repository call.
 /// </param>
 public BaseRepository(string connectionString,
                       int?commandTimeout,
                       ConnectionPersistency connectionPersistency,
                       ICache cache,
                       int cacheItemExpiration            = Constant.DefaultCacheItemExpirationInMinutes,
                       ITrace trace                       = null,
                       IStatementBuilder statementBuilder = null)
 {
     DbRepository = new DbRepository <TDbConnection>(connectionString,
                                                     commandTimeout,
                                                     connectionPersistency,
                                                     cache,
                                                     cacheItemExpiration,
                                                     trace,
                                                     statementBuilder);
 }
示例#3
0
 /// <summary>
 /// Creates a new instance of <see cref="DbRepository{TDbConnection}"/> object.
 /// </summary>
 /// <param name="connectionString">The connection string to be used by this repository.</param>
 /// <param name="commandTimeout">The command timeout in seconds to be used on every operation by this repository.</param>
 /// <param name="connectionPersistency">
 /// The database connection persistency type. Setting to <see cref="ConnectionPersistency.Instance"/> will make the repository re-used a single connection all throughout its lifespan. Setting
 /// to <see cref="ConnectionPersistency.PerCall"/> will create a new connection object on every repository call.
 /// </param>
 /// <param name="cache">The cache object to be used by this repository. This object must implement the <see cref="ICache"/> interface.</param>
 /// <param name="cacheItemExpiration">The expiration in minutes of the cache item.</param>
 /// <param name="trace">The trace object to be used by this repository. This object must implement the <see cref="ITrace"/> interface.</param>
 /// <param name="statementBuilder">The SQL statement builder object to be used by this repository. This object must implement the <see cref="IStatementBuilder"/> interface.</param>
 public DbRepository(string connectionString,
                     int?commandTimeout,
                     ConnectionPersistency connectionPersistency,
                     ICache cache                       = null,
                     int?cacheItemExpiration            = Constant.DefaultCacheItemExpirationInMinutes,
                     ITrace trace                       = null,
                     IStatementBuilder statementBuilder = null)
 {
     // Properties
     ConnectionString      = connectionString;
     CommandTimeout        = commandTimeout;
     ConnectionPersistency = connectionPersistency;
     Cache = (cache ?? new MemoryCache());
     CacheItemExpiration = cacheItemExpiration;
     Trace            = trace;
     StatementBuilder = statementBuilder;
 }