示例#1
0
        /// <summary>
        /// Initializes a new instance of <see cref="ODataUriParserConfiguration"/>.
        /// </summary>
        /// <param name="model">Model to use for metadata binding.</param>
        /// <param name="container">The optional dependency injection container to get related services for URI parsing.</param>
        /// <exception cref="System.ArgumentNullException">Throws if input model is null.</exception>
        /// <exception cref="ArgumentException">Throws if the input serviceRoot is not an AbsoluteUri</exception>
        public ODataUriParserConfiguration(IEdmModel model, IServiceProvider container)
        {
            ExceptionUtils.CheckArgumentNotNull(model, "model");

            this.Model           = model;
            this.Container       = container;
            this.Resolver        = ODataUriResolver.GetUriResolver(container);
            this.urlKeyDelimiter = ODataUrlKeyDelimiter.GetODataUrlKeyDelimiter(container);

            if (this.Container == null)
            {
                this.Settings = new ODataUriParserSettings();
            }
            else
            {
                this.Settings = this.Container.GetRequiredService <ODataUriParserSettings>();
            }

            this.EnableUriTemplateParsing = false;
        }
示例#2
0
        /// <summary>
        /// Wraps call to FindTypeFromModel for an Enum type.
        /// </summary>
        /// <param name="model">the model to search</param>
        /// <param name="qualifiedName">the name to find within the model</param>
        /// <returns>a type reference to the enum type, or null if no such type exists.</returns>
        public static IEdmEnumType FindEnumTypeFromModel(IEdmModel model, string qualifiedName)
        {
            IEdmEnumType enumType = FindTypeFromModel(model, qualifiedName, ODataUriResolver.GetUriResolver(null)) as IEdmEnumType;

            return(enumType);
        }