Miado - Much-improved ADO.Net
Return the first instance of a strongly-typed business object that is populated from the result set of a given query

Namespace:  Miado
Assembly:  Miado (in Miado.dll) Version: 0.8.10214.0 (0.8.10214.0)

Syntax

C#
T QueryForOne<T>(
	IDictionary<string, string> propertyToColumnMapping
)
where T : new()
Visual Basic (Declaration)
Function QueryForOne(Of T As New) ( _
	propertyToColumnMapping As IDictionary(Of String, String) _
) As T
Visual C++
generic<typename T>
where T : gcnew()
T QueryForOne(
	IDictionary<String^, String^>^ propertyToColumnMapping
)

Parameters

propertyToColumnMapping
Type: System.Collections.Generic..::.IDictionary<(Of <(String, String>)>)
a Dictionary containing mappings of Properties on type T to columns in the result set

Type Parameters

T
the type of object that will be created using the DbDataReader

Return Value

the first object returned from the query

Remarks

This method is offered as pure syntactical sugar. It has two concerns: 1) it has no compile time safety; and 2) it uses reflection to access the properties, so it will be much slower than using the QueryForResults() method using a standard DbDataReader

See Also