Esempio n. 1
0
        /// <summary>
        /// 创建高级实体表
        /// </summary>
        /// <param name="root"></param>
        /// <param name="master"></param>
        /// <param name="memberField"></param>
        /// <param name="isMultiple"></param>
        /// <returns></returns>
        private static DataTable CreateEntityObjectProTable(DataTable root, DataTable master, IDataField memberField, Type objectType)
        {
            var fields = new List <IDataField>();

            fields.AddRange(DataModel.GetObjectFields(objectType, master.IsSnapshot)); //增加对象定义的领域属性

            return(DataTable.Create(root,
                                    master,
                                    objectType,
                                    master.IsSnapshot,//根据从表,判断是否为快照
                                    DataTableType.EntityObjectPro, fields, memberField));
        }
Esempio n. 2
0
        /// <summary>
        /// 创建根内部引用外部根时映射的表
        /// </summary>
        /// <param name="master"></param>
        /// <param name="memberField"></param>
        /// <param name="objectType"></param>
        /// <returns></returns>
        private static DataTable CreateAggregateRootTable(DataTable root, DataTable master, IDataField memberField, Type objectType)
        {
            //var model = DataModel.CreateNew(objectType);
            //var table = model.Root;
            //table.Root = root;
            //table.Master = master;
            //table.MemberField = memberField;
            //return table;



            var objectFields = DataModel.GetObjectFields(objectType, master.IsSnapshot);
            var table        = Create(root, master, objectType, master.IsSnapshot, DataTableType.AggregateRoot, objectFields, memberField);

            return(table);
            //return DataTable.Create(root, master, objectType, DataTableType.AggregateRoot, memberField);
        }
Esempio n. 3
0
        /// <summary>
        /// 创建实体对象的表
        /// </summary>
        /// <param name="root"></param>
        /// <param name="master"></param>
        /// <param name="memberField"></param>
        /// <param name="isMultiple"></param>
        /// <returns></returns>
        private static DataTable CreateEntityObjectTable(DataTable root, DataTable master, IDataField memberField, Type objectType)
        {
            //注意,在内聚模型中,只要是实体对象,那么它就是相对于内聚根的实体对象,而不是所在对象的实体对象
            //因此,所有的实体对象,外键存放的都是内聚根的编号
            var fields = new List <IDataField>();

            fields.AddRange(DataModel.GetObjectFields(objectType, master.IsSnapshot)); //增加对象定义的领域属性
            if (!objectType.IsDerived())
            {
                //派生类不必有引用次数
                fields.Add(GeneratedField.CreateAssociatedCount(objectType));//追加被引用次数
            }

            return(DataTable.Create(root,
                                    master,
                                    objectType,
                                    master.IsSnapshot,//根据从表,判断是否为快照
                                    DataTableType.EntityObject, fields, memberField));
        }
Esempio n. 4
0
        private static IEnumerable <string> GetIndexs()
        {
            List <string> tables = new List <string>();

            foreach (var objectType in DomainObject.TypeIndex)
            {
                if (DomainObject.IsEmpty(objectType))
                {
                    continue;
                }
                var fileds = DataModel.GetObjectFields(objectType, false);
                AddIndexName(tables, objectType.Name);
                var relatedNames = GetRelatedNames(objectType, fileds);
                foreach (var relatedName in relatedNames)
                {
                    AddIndexName(tables, relatedName);
                }
            }
            return(tables.Distinct());
        }
Esempio n. 5
0
        /// <summary>
        /// 创建值对象的表
        /// </summary>
        /// <param name="root"></param>
        /// <param name="master"></param>
        /// <param name="memberField"></param>
        /// <param name="isMultiple"></param>
        /// <returns></returns>
        private static DataTable CreateValueObjectTable(DataTable root, DataTable master, IDataField memberField, Type objectType)
        {
            var fields = new List <IDataField>();

            fields.Add(GeneratedField.CreateValueObjectPrimaryKey(objectType));        //追加主键
            fields.AddRange(DataModel.GetObjectFields(objectType, master.IsSnapshot)); //增加对象定义的领域属性

            if (!objectType.IsDerived())
            {
                //派生类不必追加引用次数
                fields.Add(GeneratedField.CreateAssociatedCount(objectType));//追加被引用次数
            }

            return(DataTable.Create(root,
                                    master,
                                    objectType,
                                    master.IsSnapshot,//根据主表,判断是否为快照
                                    DataTableType.ValueObject,
                                    fields,
                                    memberField));
        }