示例#1
0
 public MTMRelationInfo(String tableName, PropertyInfo OwnMTMProp)
 {
     this.tableName  = tableName;
     this.OwnMTMProp = OwnMTMProp;
     this.OppType    = OwnMTMProp.PropertyType.GetGenericArguments()[0];
     this.OppMTMProp = this.OppType.GetProperty(CustomAttr.GetMTMTargetAndTable(OwnMTMProp).Item1);
 }
示例#2
0
        public BaseClass()
        {
            String name = this.GetType().Name;

            if (!InheritedTypes.ContainsKey(name))
            {
                InheritedTypes.Add(name, this.GetType());

                AllPrimitiveInfos.Add(name, new List <PropertyInfo>());
                AllOTORelInfos.Add(name, new List <PropertyInfo>());
                AllOTM_One.Add(name, new List <PropertyInfo>());
                AllOrderedInfos.Add(name, new List <PropertyInfo>());
                AllMTMInfoList.Add(name, new List <MTMRelationInfo>());

                List <PropertyInfo> infos = this.GetType().GetProperties().ToList();
                foreach (PropertyInfo info in infos)
                {
                    if (info.PropertyType.IsSubclassOf(typeof(BaseClass)))
                    {
                        AllOTORelInfos[name].Add(info);
                        AllOrderedInfos[name].Add(info);
                    }
                    else if (info.PropertyType.IsGenericType)
                    {
                        if (CustomAttr.GetOTMTarget(info) != null)
                        {
                            AllOTM_One[name].Add(info);
                        }
                        else
                        {
                            Tuple <string, string> Target_Table = CustomAttr.GetMTMTargetAndTable(info);
                            if (Target_Table != null)
                            {
                                Type         targetType = info.PropertyType.GetGenericArguments()[0];
                                PropertyInfo targetInfo = info.PropertyType.GetGenericArguments()[0].GetProperty(Target_Table.Item1);

                                if (!AllMTMRelations.Any(e => e.Key == Target_Table.Item2)) //tablo adına göre kontrol ediyor
                                {
                                    AllMTMRelations.Add(
                                        Target_Table.Item2, new Tuple <Type, Type>(this.GetType(), targetType)
                                        );
                                }
                                AllMTMInfoList[name].Add(new MTMRelationInfo(Target_Table.Item2, info));
                            }
                        }
                    }
                    else
                    {
                        AllPrimitiveInfos[name].Add(info);
                        AllOrderedInfos[name].Add(info);
                    }
                }
                RowSizes.Add(name, FileOps.CalculateRowByteSize(OrderedInfos(), OTORelInfos(), PrimitiveInfos()));
            }
        }