private void InitTableName() { var attr = DtoType.Attribute <TableAttribute>(); var name = attr?.SchemaQualifiedTableName; if (name == null && SimpleSaveConfiguration.Configuration.AutoGenerateTableName) { TableName = SimpleSaveConfiguration.Configuration.PluralizeTableName ? $"{DtoType.Name}s" : DtoType.Name; return; } TableName = name; }
private void InitProperties() { IList <PropertyMetadata> writeable = new List <PropertyMetadata>(); var all = new List <PropertyMetadata>(); IsReferenceData = DtoType.HasAttribute <ReferenceDataAttribute>(); HasUpdateableForeignKeys = IsReferenceData && DtoType.Attribute <ReferenceDataAttribute>().HasUpdateableForeignKeys; foreach (var prop in DtoType.PropertiesWith(Flags.InstancePublic)) { var propMeta = new PropertyMetadata(prop); all.Add(propMeta); _propertiesByCaseInsensitiveColumnName[propMeta.ColumnName] = propMeta; if (!propMeta.IsSaveable) { continue; } if (propMeta.IsPrimaryKey) { PrimaryKey = propMeta; } if (propMeta.IsSoftDeletable) { SoftDeleteProperty = propMeta; } writeable.Add(propMeta); } if (!string.IsNullOrEmpty(TableName)) { // If this type represents a table then we want to deduplicate properties // mapped to columns, otherwise we don't really care. writeable = DeduplicateWriteablePropertiesMappedToColumns(writeable); } WriteableProperties = writeable; AllProperties = all; }