Esempio n. 1
0
        //public T GetFirst()
        //{
        //    foreach (T t in this.Values)
        //    {
        //        return t;
        //    }
        //    return default(T);
        //}
        //public new  void Clear()
        //{
        //    DeleteAll();
        //}

        //public T GetByName(string name)
        //{
        //    //2_DO caching in collection, nu is er een extra call naar de database
        //    T t = new T();
        //    t.Load(id);
        //    return t;
        //}

        public virtual string CreateBackupSQL()
        {
            _sqlCreator = SqlCreator.Get();
            string sql = _sqlCreator.CreateBackupStatement(this);

            return(sql);
        }
Esempio n. 2
0
        private void reload()
        {
            this.Clear();

            Type   type      = typeof(T);
            T      t         = new T();
            string tableName = t.TableName;

            if (this.TableName != null && this.TableName != "")
            {
                tableName = this.TableName;
            }
            string   connectionName = t.ConnectionName;
            DataBase db             = DataBase.Get(connectionName);

            if (this.ConnectionString != "" && this.ConnectionString != null)
            {
                db = DataBase.Get("mysql", this.ConnectionString);
            }

            //als er geen database is, zoals bij remote WCF connectie, dan niks doen
            if (db == null)
            {
                return;
            }

            string sql = SqlCreator.Get().CreateSelectStatement(tableName, Where, OrderBy, PageNumber, PageSize, FromRowNumber);

            sql = sql.Replace("\\", "\\\\");
            DataTable dataTable = db.GetDataTable(sql);

            foreach (DataRow dataRow in dataTable.Rows)
            {
                t    = new T();
                t.db = db;
                t.FillObject(type, dataRow);

                this.Add(t);
            }
        }
Esempio n. 3
0
 public BaseObject()
 {
     db          = DataBase.Get(this.ConnectionName);
     _sqlCreator = SqlCreator.Get();
 }