public static EdmProperty Clone(this EdmProperty tableColumn)
        {
            DebugCheck.NotNull(tableColumn);

            var columnMetadata
                = new EdmProperty(tableColumn.Name, tableColumn.TypeUsage)
                    {
                        Nullable = tableColumn.Nullable,
                        StoreGeneratedPattern = tableColumn.StoreGeneratedPattern,
                        IsFixedLength = tableColumn.IsFixedLength,
                        IsMaxLength = tableColumn.IsMaxLength,
                        IsUnicode = tableColumn.IsUnicode,
                        MaxLength = tableColumn.MaxLength,
                        Precision = tableColumn.Precision,
                        Scale = tableColumn.Scale
                    };

            tableColumn.Annotations.Each(a => columnMetadata.GetMetadataProperties().Add(a));

            return columnMetadata;
        }
Пример #2
0
 private static void AddAttributeAnnotation(EdmProperty property, Attribute a)
 {
     if (property != null)
     {
         var clrAttributes = property.Annotations.GetClrAttributes();
         if (clrAttributes != null)
         {
             if (!clrAttributes.Contains(a))
             {
                 clrAttributes.Add(a);
             }
         }
         else
         {
             property.GetMetadataProperties().SetClrAttributes(
                 new List <Attribute>
             {
                 a
             });
         }
     }
 }
        private static void AddAttributeAnnotation(EdmProperty property, Attribute a)
        {
            if (property == null)
            {
                return;
            }
            IList <Attribute> clrAttributes = property.Annotations.GetClrAttributes();

            if (clrAttributes != null)
            {
                if (clrAttributes.Contains(a))
                {
                    return;
                }
                clrAttributes.Add(a);
            }
            else
            {
                property.GetMetadataProperties().SetClrAttributes((IList <Attribute>) new List <Attribute>()
                {
                    a
                });
            }
        }
 private static void AddAttributeAnnotation(EdmProperty property, Attribute a)
 {
     if (property != null)
     {
         var clrAttributes = property.Annotations.GetClrAttributes();
         if (clrAttributes != null)
         {
             if (!clrAttributes.Contains(a))
             {
                 clrAttributes.Add(a);
             }
         }
         else
         {
             property.GetMetadataProperties().SetClrAttributes(
                 new List<Attribute>
                     {
                         a
                     });
         }
     }
 }