public TypeColumn(string columnName, string identifierName, FieldInfo info, bool viewOnly, bool isPrimaryKey, bool isIdentity, int size) { IsPrimaryKey = isPrimaryKey; IsIdentity = isIdentity; Size = size; Name = columnName; if (info.FieldType.Name.ToUpper() == "NULLABLE`1") { Type = Nullable.GetUnderlyingType(info.FieldType); IsNullable = true; } else { Type = info.FieldType; } IsNumeric = Misc.IsNumericType(Type); ColumnInfo = info; MemberName = info.Name; ColumnHolder = identifierName; m_columnStructureType = ColumnStructureType.Field; m_viewOnly = viewOnly; }
public TypeColumn(string columnName, string identifierName, PropertyInfo info, bool viewOnly, bool isPrimaryKey, bool isIdentity, int size) { IsPrimaryKey = isPrimaryKey; IsIdentity = isIdentity; Size = size; Name = columnName; if (info.PropertyType.Name.ToUpper() == "NULLABLE`1") { Type = Nullable.GetUnderlyingType(info.PropertyType); IsNullable = true; } else Type = info.PropertyType; IsNumeric = Misc.IsNumericType(Type); PropertyInfo = info; MemberName = info.Name; ColumnHolder = identifierName; m_columnStructureType = ColumnStructureType.Property; m_viewOnly = viewOnly; }
internal void ReadXml(XmlReader reader, Type type) { var columnName = string.Empty; var storage = string.Empty; var property = string.Empty; var size = 0; var isPrimaryKey = false; var isIdentity = false; var isViewOnly = false; var lazyLoad = false; while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "Name": columnName = reader.Value; break; case "IsPrimaryKey": isPrimaryKey = bool.Parse(reader.Value); break; case "Storage": storage = reader.Value; break; case "IsIdentity": isIdentity = bool.Parse(reader.Value); break; case "Property": property = reader.Value; break; case "m_viewOnly": isViewOnly = bool.Parse(reader.Value); break; case "Size": size = int.Parse(reader.Value); break; case "LazyLoad": lazyLoad = bool.Parse(reader.Value); break; } } if (storage == string.Empty) storage = property; if (property == string.Empty && storage == string.Empty) throw new Exception("No Place Holder Specified"); IsPrimaryKey = isPrimaryKey; IsIdentity = isIdentity; Size = size; Name = columnName; var info = GetMemberInfo(type, storage); switch (info.MemberType) { case MemberTypes.Property: var pInfo = info as PropertyInfo; if (pInfo == null) break; if (pInfo.PropertyType.Name.ToUpper() == "NULLABLE`1") { Type = Nullable.GetUnderlyingType(pInfo.PropertyType); IsNullable = true; } else Type = pInfo.PropertyType; PropertyInfo = pInfo; m_columnStructureType = ColumnStructureType.Property; break; case MemberTypes.Field: var fInfo = info as FieldInfo; if (fInfo == null) break; if (fInfo.FieldType.Name.ToUpper() == "NULLABLE`1") { Type = Nullable.GetUnderlyingType(fInfo.FieldType); IsNullable = true; } else Type = fInfo.FieldType; ColumnInfo = fInfo; m_columnStructureType = ColumnStructureType.Field; break; } IsNumeric = Misc.IsNumericType(Type); MemberName = info.Name; ColumnHolder = property; ViewOnly = isViewOnly; LazyLoad = lazyLoad; }
internal void ReadXml(XmlReader reader, Type type) { var columnName = string.Empty; var storage = string.Empty; var property = string.Empty; var size = 0; var isPrimaryKey = false; var isIdentity = false; var isViewOnly = false; while (reader.MoveToNextAttribute()) { switch (reader.Name) { case "Name": columnName = reader.Value; break; case "IsPrimaryKey": isPrimaryKey = bool.Parse(reader.Value); break; case "Storage": storage = reader.Value; break; case "IsIdentity": isIdentity = bool.Parse(reader.Value); break; case "Property": property = reader.Value; break; case "m_viewOnly": isViewOnly = bool.Parse(reader.Value); break; case "Size": size = int.Parse(reader.Value); break; } } if (storage == string.Empty) { storage = property; } if (property == string.Empty && storage == string.Empty) { throw new Exception("No Place Holder Specified"); } IsPrimaryKey = isPrimaryKey; IsIdentity = isIdentity; Size = size; Name = columnName; var info = GetMemberInfo(type, storage); switch (info.MemberType) { case MemberTypes.Property: var pInfo = info as PropertyInfo; if (pInfo == null) { break; } if (pInfo.PropertyType.Name.ToUpper() == "NULLABLE`1") { Type = Nullable.GetUnderlyingType(pInfo.PropertyType); IsNullable = true; } else { Type = pInfo.PropertyType; } PropertyInfo = pInfo; m_columnStructureType = ColumnStructureType.Property; break; case MemberTypes.Field: var fInfo = info as FieldInfo; if (fInfo == null) { break; } if (fInfo.FieldType.Name.ToUpper() == "NULLABLE`1") { Type = Nullable.GetUnderlyingType(fInfo.FieldType); IsNullable = true; } else { Type = fInfo.FieldType; } ColumnInfo = fInfo; m_columnStructureType = ColumnStructureType.Field; break; } IsNumeric = Misc.IsNumericType(Type); MemberName = info.Name; ColumnHolder = property; ViewOnly = isViewOnly; }