public static EdmProperty IncludeColumn( EntityType table, EdmProperty templateColumn, Func<EdmProperty, bool> isCompatible, bool useExisting) { DebugCheck.NotNull(table); DebugCheck.NotNull(templateColumn); var existingColumn = table.Properties.FirstOrDefault(isCompatible); if (existingColumn == null) { templateColumn = templateColumn.Clone(); } else if (!useExisting && !existingColumn.IsPrimaryKeyColumn) { templateColumn = templateColumn.Clone(); } else { templateColumn = existingColumn; } AddColumn(table, templateColumn); return templateColumn; }
public static EdmProperty IncludeColumn( EntityType table, EdmProperty templateColumn, bool useExisting) { DebugCheck.NotNull(table); DebugCheck.NotNull(templateColumn); var existingColumn = table.Properties.SingleOrDefault(c => string.Equals(c.Name, templateColumn.Name, StringComparison.Ordinal)); if (existingColumn == null) { templateColumn = templateColumn.Clone(); } else if (!useExisting && !existingColumn.IsPrimaryKeyColumn) { templateColumn = templateColumn.Clone(); } else { templateColumn = existingColumn; } AddColumn(table, templateColumn); return templateColumn; }