private void BuildColumnMapping(string identity, EdmProperty property, string propertyName, ColumnMapping columnMapping) { if (_primaryKeysMapping[identity].Contains(propertyName)) { columnMapping.IsPk = true; } foreach (var facet in property.TypeUsage.Facets) { switch (facet.Name) { case "Nullable": columnMapping.Nullable = (bool)facet.Value; break; case "DefaultValue": columnMapping.DefaultValue = facet.Value; break; case "StoreGeneratedPattern": columnMapping.IsIdentity = (StoreGeneratedPattern)facet.Value == StoreGeneratedPattern.Identity; columnMapping.Computed = (StoreGeneratedPattern)facet.Value == StoreGeneratedPattern.Computed; break; case "MaxLength": columnMapping.MaxLength = (int)facet.Value; break; } } }
public ColumnMapping AddColumn(string property, string columnName) { var cmap = new ColumnMapping(property, columnName); _columnMappings.Add(property, cmap); return cmap; }