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