ModelBuilder.CreationRule.Create C# (CSharp) Method

Create() public method

Creates a value using the specified type, property name and context.
public Create ( Type type, string propertyName, LinkedList buildChain ) : object
type System.Type The type to match.
propertyName string The property name to match.
buildChain LinkedList The chain of instances built up to this point.
return object
        public object Create(Type type, string propertyName, LinkedList<object> buildChain)
        {
            if (IsMatch(type, propertyName) == false)
            {
                var typeName = "<null>";

                if (type != null)
                {
                    typeName = type.FullName;
                }

                var message = string.Format(
                    CultureInfo.CurrentCulture,
                    Resources.Rule_InvalidMatch,
                    GetType().Name,
                    typeName,
                    propertyName);

                throw new NotSupportedException(message);
            }
            
            return _creator(type, propertyName, buildChain);
        }