How can we use XML files to map stored procedures with .NET classes?

 Posted by ArticlesMaint on 9/29/2009 | Category: LINQ Interview questions | Views: 2377

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.

<?xml version="1.0" encoding="utf-8"?>

<Database Name="TstServer" xmlns="">
<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" />
<Function Name="dbo.sp_getCustomerCode" Method="getCustomerByCode">
<Parameter Name="CustomerCode" Parameter="" />
<ElementType Name="clsCustomer" />

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response