How can we use XML files to map stored procedures with .NET classes?
By j Miracle
here i will show you that who can we use XML files to map stored procedures with .NET classes.
In case you have stored procedures in your project you can use ‘Function’ XML element
to define your stored procedure name in the XML file. The client code does not
change for binding the datacontext and XMLMappingsource object as below.
<?xml version="1.0" encoding="utf-8"?>
<Database
Name="TstServer" xmlns="http://schemas.microsoft.com/linqtosql/mapping/2007">
<Table
Name="dbo.Customer" Member="WebAppMappingXML.clsCustomer">
<Type
Name="WebAppMappingXML.clsCustomer">
<Column Name="CustomerId"
Member="CustomerId" />
<Column Name="CustomerName"
Member="CustomerName" />
<Column Name="CustomerCode"
Member="CustomerCode" />
</Type>
</Table>
<Function
Name="dbo.sp_getCustomerCode" Method="getCustomerByCode">
<Parameter
Name="CustomerCode" Parameter="" />
<ElementType
Name="clsCustomer" />
</Function>
</Database>
How can we use XML files to map stored procedures with .NET classes? (750 Views)