Pomona.Common.TypeSystem.TypeSpec.GetPropertyByName C# (CSharp) Method

GetPropertyByName() public method

public GetPropertyByName ( string propertyName, bool ignoreCase ) : PropertySpec
propertyName string
ignoreCase bool
return PropertySpec
        public PropertySpec GetPropertyByName(string propertyName, bool ignoreCase)
        {
            PropertySpec propertySpec;
            if (!TryGetPropertyByName(propertyName, ignoreCase, out propertySpec))
                throw new KeyNotFoundException("Property with name not found");
            return propertySpec;
        }

Usage Example

Ejemplo n.º 1
0
        public override IEnumerable <PropertySpec> LoadRequiredProperties(TypeSpec typeSpec)
        {
            if (typeSpec == null)
            {
                throw new ArgumentNullException(nameof(typeSpec));
            }
            var transformedType = typeSpec as StructuredType;

            if (transformedType != null)
            {
                if (!transformedType.PostAllowed)
                {
                    return(Enumerable.Empty <PropertySpec>());
                }
                if (transformedType.Constructor != null)
                {
                    IEnumerable <PropertySpec> requiredProperties =
                        transformedType.Constructor.ParameterSpecs.Where(x => x.IsRequired).Select(
                            x => typeSpec.GetPropertyByName(x.PropertyInfo.Name, true)).ToList();
                    return
                        (requiredProperties);
                }
            }

            return(base.LoadRequiredProperties(typeSpec));
        }
All Usage Examples Of Pomona.Common.TypeSystem.TypeSpec::GetPropertyByName