public virtual void AddPropertiesToModel([NotNull] Entity.Metadata.Model relationalModel) { Check.NotNull(relationalModel, nameof(relationalModel)); foreach (var tc in _tableColumns.Values) { var table = _tables[tc.TableId]; if (!_tableSelectionSet.Allows(table.SchemaName, table.TableName)) { continue; } EntityType entityType; if (!_tableIdToEntityType.TryGetValue(tc.TableId, out entityType)) { Logger.LogWarning( SqlServerDesignStrings.CannotFindTableForColumn(tc.Id, tc.TableId)); continue; } // If we come across a column with a SQL Server type which we can't map we will ignore it. // Note: foreign key properties appear just like any other property in the relational model. Type clrPropertyType; if (!SqlServerTypeMapping._sqlTypeToClrTypeMap.TryGetValue(tc.DataType, out clrPropertyType)) { Logger.LogWarning( SqlServerDesignStrings.CannotFindTypeMappingForColumn(tc.Id, tc.DataType)); continue; } if (tc.IsNullable) { clrPropertyType = clrPropertyType.MakeNullable(); } var property = entityType.AddProperty(tc.Id, clrPropertyType); property.Relational().ColumnName = _tableColumns[tc.Id].ColumnName; _columnIdToProperty[tc.Id] = property; AddFacetsOnProperty(property, _tableColumns[tc.Id]); } }