Beispiel #1
0
 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();
 }
Beispiel #2
0
        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);
        }