Represents the result of a mapped function that has a single return sequence.
Namespace:
System.Data.Linq
Assembly:
System.Data.Linq (in System.Data.Linq.dll)
Visual Basic (Declaration)
Public Interface ISingleResult(Of T) _
Inherits IEnumerable(Of T), IEnumerable, IFunctionResult, _
IDisposable
Dim instance As ISingleResult(Of T)
public interface ISingleResult<T> : IEnumerable<T>,
IEnumerable, IFunctionResult, IDisposable
generic<typename T>
public interface class ISingleResult : IEnumerable<T>,
IEnumerable, IFunctionResult, IDisposable
JScript does not support generic types or methods.
Type Parameters
- T
The type of the elements in the return sequence.
The following example represents a stored procedure that returns rows of customers and uses an input parameter to return only those rows that list "London" as the customer city. The example assumes an enumerable CustomersByCityResult class.
CREATE PROCEDURE [dbo].[Customers By City]
(@param1 NVARCHAR(20))
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT CustomerID, ContactName, CompanyName, City from Customers
as c where c.City=@param1
END
<FunctionAttribute(Name:="dbo.Customers By City")> _
Public Function CustomersByCity(<Parameter(DbType:="NVarChar(20)")> ByVal param1 As String) As ISingleResult(Of CustomersByCityResult)
Dim result As IExecuteResult = Me.ExecuteMethodCall(Me, CType(MethodInfo.GetCurrentMethod, MethodInfo), param1)
Return CType(result.ReturnValue, ISingleResult(Of CustomersByCityResult))
End Function
Sub ReturnRowset()
' Call the stored procedure.
Dim db As New Northwnd("c:\northwnd.mdf")
Dim result As IEnumerable(Of CustomersByCityResult) = _
db.CustomersByCity("London")
For Each cust As CustomersByCityResult In result
Console.WriteLine("CustID={0}; City={1}", _
cust.CustomerID, cust.City)
Next
End Sub
[Function(Name="dbo.Customers By City")]
public ISingleResult<CustomersByCityResult> CustomersByCity([Parameter(DbType="NVarChar(20)")] string param1)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), param1);
return ((ISingleResult<CustomersByCityResult>)(result.ReturnValue));
}
// Call the stored procedure.
void ReturnRowset()
{
Northwnd db = new Northwnd(@"c:\northwnd.mdf");
ISingleResult<CustomersByCityResult> result =
db.CustomersByCity("London");
foreach (CustomersByCityResult cust in result)
{
Console.WriteLine("CustID={0}; City={1}", cust.CustomerID,
cust.City);
}
}
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5
Reference