Example #1
0
        public void SyncTables(ITransacBuilder transacBuilder, DalLayerInfo dalInfo, Type[] entityTypes)
        {
            List <string> sqls = new List <string>();

            object[] customAttributes;
            Type     attType = typeof(EntityAttribute);

            foreach (Type item in entityTypes)
            {
                bool isEntity = false;
                customAttributes = item.GetCustomAttributes(false);
                if (customAttributes != null)
                {
                    foreach (var a in customAttributes)
                    {
                        if (a.GetType() == attType)
                        {
                            isEntity = true;
                            break;
                        }
                    }
                }
                if (!isEntity)
                {
                    continue;
                }
                List <string> tempSql = dalInfo.Provider.GetNewColumnsCommandTexts(dalInfo, item);
                if (tempSql != null && tempSql.Count > 0)
                {
                    sqls.AddRange(tempSql);
                }
            }
            foreach (var item in sqls)
            {
                transacBuilder.AddCommandText(item);
            }
        }
Example #2
0
        public void SyncTables(ITransacBuilder transacBuilder)
        {
            DBHelper dbHelper = new DBHelper();

            dbHelper.SyncTables(transacBuilder, dalInfo, entityTypes);
        }