void Init() { TestMode = this._db.DataProvider.ConnectionString.Equals("test", StringComparison.InvariantCultureIgnoreCase); _dirtyColumns = new List <IColumn>(); if (TestMode) { Position.SetTestRepo(); _repo = _testRepo; } else { _repo = new SubSonicRepository <Position>(_db); } tbl = _repo.GetTable(); SetIsNew(true); OnCreated(); }
internal static IRepository <Position> GetRepo(string connectionString, string providerName) { Solution.DataAccess.DataModel.SubSonicTestDB db; if (String.IsNullOrEmpty(connectionString)) { db = new Solution.DataAccess.DataModel.SubSonicTestDB(); } else { db = new Solution.DataAccess.DataModel.SubSonicTestDB(connectionString, providerName); } IRepository <Position> _repo; if (db.TestMode) { Position.SetTestRepo(); _repo = _testRepo; } else { _repo = new SubSonicRepository <Position>(db); } return(_repo); }