Beispiel #1
0
 public static void AddColumn(EntityType table, EdmProperty column)
 {
     if (table.Properties.Contains(column))
     {
         return;
     }
     System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration configuration = column.GetConfiguration() as System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration;
     if (configuration == null || string.IsNullOrWhiteSpace(configuration.ColumnName))
     {
         string name = column.GetPreferredName() ?? column.Name;
         column.SetUnpreferredUniqueName(column.Name);
         column.Name = ((IEnumerable <INamedDataModelItem>)table.Properties).UniquifyName(name);
     }
     table.AddMember((EdmMember)column);
 }
        public static void AddColumn(EntityType table, EdmProperty column)
        {
            DebugCheck.NotNull(table);
            DebugCheck.NotNull(column);

            if (!table.Properties.Contains(column))
            {
                var configuration = column.GetConfiguration() as PrimitivePropertyConfiguration;

                if ((configuration == null) ||
                    string.IsNullOrWhiteSpace(configuration.ColumnName))
                {
                    var preferredName = column.GetPreferredName() ?? column.Name;
                    column.SetUnpreferredUniqueName(column.Name);
                    column.Name = table.Properties.UniquifyName(preferredName);
                }

                table.AddMember(column);
            }
        }