示例#1
0
        public virtual IEnumerable <string> GetFieldNames([NotNull] PropertyInfo entityProperty)
        {
            Assert.ArgumentNotNull(entityProperty, "entityProperty");

            List <string> names = new List <string>();

            EntityAttribute entityAttribute = Attribute.GetCustomAttribute(entityProperty, typeof(EntityAttribute), true) as EntityAttribute;

            if (entityAttribute != null && !string.IsNullOrEmpty(entityAttribute.FieldName))
            {
                names.Add(entityAttribute.FieldName);
            }
            else
            {
                string defaultName = entityProperty.Name;
                names.Add(defaultName);

                FieldNamingPolicy policy        = new FieldNamingPolicy();
                string            alternateName = policy.GetFieldName(entityProperty.Name);

                if (defaultName != alternateName)
                {
                    names.Add(alternateName);
                }
            }

            return(names);
        }
    public virtual IEnumerable<string> GetFieldNames([NotNull] PropertyInfo entityProperty)
    {
      Assert.ArgumentNotNull(entityProperty, "entityProperty");

      List<string> names = new List<string>();

      EntityAttribute entityAttribute = Attribute.GetCustomAttribute(entityProperty, typeof(EntityAttribute), true) as EntityAttribute;
      if (entityAttribute != null && !string.IsNullOrEmpty(entityAttribute.FieldName))
      {
        names.Add(entityAttribute.FieldName);
      }
      else
      {
        string defaultName = entityProperty.Name;
        names.Add(defaultName);

        FieldNamingPolicy policy = new FieldNamingPolicy();
        string alternateName = policy.GetFieldName(entityProperty.Name);

        if (defaultName != alternateName)
        {
          names.Add(alternateName);
        }
      }

      return names;
    }