internal static TypeAttributeMapping FromMember(TypeMapping declaringType, MemberInfo memberInfo) { string name = null; SqlType sqlType = GetSqlType(memberInfo); int size = -1; int scale = -1; bool nullable = true; object[] attrs = memberInfo.GetCustomAttributes(true); for (int i = 0; i < attrs.Length; i++) { object attr = attrs[i]; if (attr is ColumnAttribute) { ColumnAttribute columnAttr = (ColumnAttribute)attr; name = columnAttr.ColumnName; sqlType = columnAttr.SqlType; size = columnAttr.Size; scale = columnAttr.Scale; } else if (attr is NotNullAttribute) { nullable = false; } } TType type = GetTType(sqlType, size, scale); return new TypeAttributeMapping(declaringType, name, type, nullable); }
internal MemberMapping(TypeMapping typeMapping, string memberName, string columnName, SqlType columnType, bool notNull) { TypeMapping = typeMapping; MemberName = memberName; ColumnName = columnName; ColumnType = columnType; NotNull = notNull; }
internal MemberMapping(TypeMapping typeMapping, MemberInfo member, string columnName, SqlType columnType, bool notNull, bool primaryKey, bool unique, bool uniqueKey) { TypeMapping = typeMapping; Member = member; ColumnName = columnName; ColumnType = columnType; NotNull = notNull; PrimaryKey = primaryKey; Unique = unique; UniqueKey = uniqueKey; }
internal TypeAttributeMapping(TypeMapping declaringType, string memberName, TType type, bool nullable) : base(declaringType, memberName) { this.type = type; this.nullable = nullable; }
internal void Map(TypeMapping mapping) { typeMappings[mapping.Type] = mapping; }
public object Clone() { TypeMapping mapping = new TypeMapping(type, (string)name.Clone(), attributes); if (memberMappings != null) mapping.memberMappings = (ArrayList) memberMappings.Clone(); return mapping; }
internal static TypeMapping FromType(Type type) { UserTypeAttributes attributes = new UserTypeAttributes(); if (type.IsSealed) attributes |= UserTypeAttributes.Sealed; else if (type.IsAbstract) attributes |= UserTypeAttributes.Abstract; TypeMapping typeMapping = new TypeMapping(type, attributes); MemberInfo[] memberInfos = type.FindMembers(global::System.Reflection.MemberTypes.Field | global::System.Reflection.MemberTypes.Property, BindingFlags.Instance | BindingFlags.Public, new MemberFilter(FilterMember), null); for (int i = 0; i < memberInfos.Length; i++) { TypeAttributeMapping mapping = TypeAttributeMapping.FromMember(typeMapping, memberInfos[i]); if (typeMapping.memberMappings == null) typeMapping.memberMappings = new ArrayList(); typeMapping.memberMappings.Add(mapping); } return typeMapping; }
internal TypeMemberMapping(TypeMapping dtype, string name) { this.name = name; this.dtype = dtype; }
public DbMappingEntity(string tableId, TypeMapping typeMapping) { this.tableId = tableId; TypeMapping = typeMapping; }