예제 #1
0
파일: DynamicMap.cs 프로젝트: quintonn/QBic
        public DynamicMap()
        {
            Table(TableName);

            if (DynamicClass.SetIdsToBeAssigned == true)
            {
                Id(x => x.Id).GeneratedBy.Assigned(); // This is for when doing backup restore.
            }
            else
            {
                Id(x => x.Id).GeneratedBy.Custom <CustomIdentifierGenerator>();
            }

            Map(x => x.CanDelete).Default("1")
            .Not.Nullable();

            var primitiveColumns    = Properties.Where(p => BaseMap.IsPrimitive(p.PropertyType) == true).Select(p => p.Name).ToList();
            var nonPrimitiveColumns = Properties.Where(p => BaseMap.IsPrimitive(p.PropertyType) == false && BaseMap.IsGenericList(p.PropertyType) == false).ToList();
            var listColumns         = Properties.Where(p => BaseMap.IsPrimitive(p.PropertyType) == false && BaseMap.IsGenericList(p.PropertyType) == true).ToList();

            this.MapPrimitiveTypes(primitiveColumns, Properties);

            this.MapNonPrimitiveTypes(TableName, nonPrimitiveColumns, false);

            this.MapLists(listColumns);
        }
예제 #2
0
        public ChildDynamicMap()
            : base()
        {
            var parentProperties = BaseMap.GetParentProperties(typeof(T).BaseType).Select(p => p.Name).ToList();

            var properties = Properties.Where(p => !parentProperties.Contains(p.Name)).ToList();

            var primitiveColumns    = properties.Where(p => BaseMap.IsPrimitive(p.PropertyType) == true).Select(p => p.Name).ToList();
            var nonPrimitiveColumns = properties.Where(p => BaseMap.IsPrimitive(p.PropertyType) == false && BaseMap.IsGenericList(p.PropertyType) == false).ToList();
            var listColumns         = properties.Where(p => BaseMap.IsPrimitive(p.PropertyType) == false && BaseMap.IsGenericList(p.PropertyType) == true).ToList();

            this.MapPrimitiveTypes(primitiveColumns, properties);

            this.MapNonPrimitiveTypes(TableName, nonPrimitiveColumns, false);

            this.MapLists(listColumns);
        }