<PersistentResultBinder> Element

Maps a set of scalar columns of a stored procedure result set to a persistent set return value of a member mapped with the <StoredProcedure/> element.

<Member name="member" [signature="parameterList"]>

        <StoredProcedure dbName="stored-procedure">

               <Result>

                       <PersistentResultBindertargetType="clrType">

                               (<FieldBinderfieldName="field"

                                [tableName="table"]

                                (columnIndex="index"|columnName="name"))+

                       </PersistentResultBinder>

               </Result>

        </StoredProcedure>
</Member>

 

clrType: Type to populate to the member result set. The return type of the member usually is Set<clrType>.

field: Database field name of the member property mapped with <PersistentField/>.

table: Database table name of the member property mapped with <PersistentField/>. This can be omitted if the result is returned from only one table (no inheritance) or if the field names are unique across all mapped tables.

index: Zero-based index of the column in the stored procedure result set from which to retrieve the value.

name: Column name of the stored procedure result set from which to retrieve the value.

Remarks

Note that the stored procedure result set is mapped on the database schema level and not on the business layer level. Therefore, you need to specify a field/table combination to populate a column to the target clrType instead of specifying a member name of the clrType.

The clrType does not need to be fully populated from the stored procedure. At the least, the object identity and the type identity (if existent) need to be initialised from the result set. Uninitialised properties of clrType are lazy loaded in full view (containing all scalar properties) when accessed.

Example

public abstract Set<Product> GetOutOfStockProducs();

can be mapped as

<Member name="GetOutOfStockProducts">

        <StoredProcedure dbName="GetOutOfStockProducts">

               <Result>

                       <PersistentResultBinder targetType="Product">

                               <FieldBinder fieldName="Id" columnIndex="0"/>

                               <FieldBinder fieldName="Name" columnIndex="1"/>

                       </PersistentResultBinder>

               </Result>

        </StoredProcedure>

</Member>

The mapping above assumes the existence of a stored procedure GetOutOfStockProductIds that returns a result set with a product id value in the first column and a product name value in the second column.

Requirements

Editions:Professional, Evaluation, Express

Database Platforms:Microsoft SQL Server 2000, Microsoft SQL Server 2005, Oracle 9i Release 2, Oracle 10g Release 2

See also

<StoredProcedure/> element, <ScalarResultbinder/> element, <CompositeResultBinder/> element



<ScalarResultBinder> Element <CompositeResultBinder> Element