Beispiel #1
0
        protected DbConnectionWrapper GetDb(bool startTransaction = false)
        {
            if (this.Db == null || this.Db.IsDisposed)
            {
                var connection = DbHelper.GetDbConnection();
                var wrapper    = new DbConnectionWrapper(connection);
                if (startTransaction)
                {
                    wrapper.StartTransaction();
                }

                this.Db = wrapper;
            }
            else
            {
                this.Db.AddScope();
            }

            return(this.Db);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the Repository class and accepts an existing DbConnectionWrapper
 /// </summary>
 /// <param name="tableName">The name of the database table</param>
 /// <param name="wrapper">The db connection wrapper object</param>
 public PersistenceRepository(string tableName, DbConnectionWrapper wrapper) : this(tableName)
 {
     this.Db = wrapper;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the Repository class and accepts an existing DbConnectionWrapper
 /// </summary>
 /// <param name="tableName">The name of the database table</param>
 /// <param name="wrapper">The db connection wrapper object</param>
 public Repository(
     string tableName,
     DbConnectionWrapper wrapper) : base(tableName, wrapper)
 {
 }