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

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

            return(single);
        }
Exemplo n.º 4
0
        public static PROD_DEP SingleOrDefault(Expression <Func <PROD_DEP, bool> > expression)
        {
            var      repo    = GetRepo();
            var      results = repo.Find(expression);
            PROD_DEP single  = null;

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

            return(single);
        }
Exemplo n.º 5
0
 void Init()
 {
     TestMode      = this._db.DataProvider.ConnectionString.Equals("test", StringComparison.InvariantCultureIgnoreCase);
     _dirtyColumns = new List <IColumn>();
     if (TestMode)
     {
         PROD_DEP.SetTestRepo();
         _repo = _testRepo;
     }
     else
     {
         _repo = new SubSonicRepository <PROD_DEP>(_db);
     }
     tbl = _repo.GetTable();
     SetIsNew(true);
     OnCreated();
 }
Exemplo n.º 6
0
        internal static IRepository <PROD_DEP> 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 <PROD_DEP> _repo;

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