Пример #1
0
        public Component(int iD)
        {
            DataTable dt;

            dataComponent = new Data.Component();
            ID            = iD;
            dt            = dataComponent.GetComponentByID(this.ID);
            foreach (DataRow dr in dt.Rows)
            {
                this.ID        = dr.IsNull("ComponentID") ? -1 : dr.Field <int>("ComponentID");
                this.EntityKey = dr.IsNull("entityKey") ? -1 : dr.Field <int>("entityKey");
                this.Type      = dr.IsNull("componentType") ? ComponentType._CoreComponent : dr.Field <ComponentType>("componentType");
            }
            base.Init();
        }
Пример #2
0
        protected bool UpdateEntityFieldType(ComponentAttribute attr)
        {
            Data.Component c = new Data.Component();
            TQueryBuilder  tq;

            tq = new TQueryBuilder(TQueryType._AlterTableColumnDataType);
            tq.TableName(this.TableName.Replace(" ", ""));
            if (attr.InstanceID > 0)
            {
                tq.AddField(attr.Name, attr.IsKey, attr.IsUnique, base.getDataType(attr.FieldType), true, "");
                c.ExecuteNonQuery(tq);
                return(true);
            }
            else
            {
                return(true);
            }
        }
Пример #3
0
        protected bool AddEntityField(ComponentAttribute componentAttribute)
        {
            Data.Component c = new Data.Component();
            TQueryBuilder  tq;

            tq = new TQueryBuilder(TQueryType._AlterColumnName);
            tq.TableName(this.TableName.Replace(" ", ""));
            if (componentAttribute.InstanceID > 0)
            {
                //  tq.AddField(fd.Name, fd.IsKey, fd.IsUnique, fd.FieldType, true, "");
                tq.AddField(componentAttribute.Name, componentAttribute.IsKey, componentAttribute.IsUnique, base.getDataType(componentAttribute.FieldType), true, "");
                c.ExecuteNonQuery(tq);
                return(true);
            }
            else
            {
                return(true);
            }
        }
Пример #4
0
 public Component() : base()
 {
     EntityInstances = new List <Entitifier.Core.EntityField>();
     dataComponent   = new Data.Component();
 }