Beispiel #1
0
 public static void Setup(int testItems)
 {
     SetTestRepo();
     for (int i = 0; i < testItems; i++)
     {
         V_PROD_CATE item = new V_PROD_CATE();
         _testRepo._items.Add(item);
     }
 }
Beispiel #2
0
 public override bool Equals(object obj)
 {
     if (obj.GetType() == typeof(V_PROD_CATE))
     {
         V_PROD_CATE compare = (V_PROD_CATE)obj;
         return(compare.KeyValue() == this.KeyValue());
     }
     else
     {
         return(base.Equals(obj));
     }
 }
Beispiel #3
0
        public static V_PROD_CATE SingleOrDefault(Expression <Func <V_PROD_CATE, bool> > expression, string connectionString, string providerName)
        {
            var         repo    = GetRepo(connectionString, providerName);
            var         results = repo.Find(expression);
            V_PROD_CATE single  = null;

            if (results.Count() > 0)
            {
                single = results.ToList()[0];
            }

            return(single);
        }
Beispiel #4
0
        public static V_PROD_CATE SingleOrDefault(Expression <Func <V_PROD_CATE, bool> > expression)
        {
            var         repo    = GetRepo();
            var         results = repo.Find(expression);
            V_PROD_CATE single  = null;

            if (results.Count() > 0)
            {
                single = results.ToList()[0];
                single.OnLoaded();
                single.SetIsLoaded(true);
                single.SetIsNew(false);
            }

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

            if (db.TestMode)
            {
                V_PROD_CATE.SetTestRepo();
                _repo = _testRepo;
            }
            else
            {
                _repo = new SubSonicRepository <V_PROD_CATE>(db);
            }
            return(_repo);
        }
Beispiel #7
0
 public static void Setup(V_PROD_CATE item)
 {
     SetTestRepo();
     _testRepo._items.Add(item);
 }