// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Linq; using System.Runtime.CompilerServices; namespace System.Web.Http { /// /// Represents an containing zero or one entities. Use together with an /// [EnableQuery] from the System.Web.Http.OData or System.Web.OData namespace. /// [TypeForwardedFrom("System.Web.Http.OData, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")] public abstract class SingleResult { /// /// Initializes a new instance of the class. /// /// The containing zero or one entities. protected SingleResult(IQueryable queryable) { if (queryable == null) { throw Error.ArgumentNull("queryable"); } Queryable = queryable; } /// /// The containing zero or one entities. /// public IQueryable Queryable { get; private set; } /// /// Creates a from an . A helper method to instantiate /// a object without having to explicitly specify the type /// . /// /// The type of the data in the data source. /// The containing zero or one entities. /// The created . public static SingleResult Create(IQueryable queryable) { return new SingleResult(queryable); } } }