view Tools/DocGen/Content/Doc/DataAccess/AbstractAccessor.htm @ 3:1ef98bd70424

!bug 100 +3h Исправление проблемы BLToolkit + mono 3.4
author cin
date Fri, 22 Aug 2014 17:34:46 +0400
parents f990fcb411a9
children
line wrap: on
line source

<% group # Abstract accessors %>
<% order # 20 %>

<p class="j">The following example demonstrates how to create and use an abstract data accessor class.
All abstract methods of the class are generated at run-time depending on each method declaration.
Every part of the method declaration is important.
Method's return value specifies one of the Execute methods in the following way:
<table class='data'>
<tr><th>Return Type</th><th>Execute Method</th></tr>
<tr><td><i>IDataReader</i> interface</td><td>ExecuteReader</td></tr>
<tr><td>Subclass of <i>DataSet</i></td><td>ExecuteDataSet</td></tr>
<tr><td>Subclass of <i>DataTable</i></td><td>ExecuteDataTable</td></tr>
<tr><td>Class implementing the <i>IList</i> interface</td><td><a href="ExecuteList.htm">ExecuteList</a> or <a href="ExecuteList.htm">ExecuteScalarList</a></td></tr>
<tr><td>Class implementing the <i>IDictionary</i> interface</td><td><a href="ExecuteDictionary.htm">ExecuteDictionary</a> or <a href="ExecuteDictionary.htm">ExecuteScalarDictionary</a></td></tr>
<tr><td><i>void</i></td><td>ExecuteNonQuery</td></tr>
<tr><td><i>string</i>, <i>byte[]</i> or value type</td><td><a href="ExecuteScalar.htm">ExecuteScalar</a></td></tr>
<tr><td>In any other case</td><td><a href="ExecuteObject.htm">ExecuteObject</a></td></tr>
</table>
Method name explicitly defines action name which is converted to stored procedure name.<br/>
Type, sequential order, and name of the method parameters is mapped to the command parameters.
Exceptions from this rule are:
<br>
<div style="margin:-10px 0px -10px -10px"><ul compact="compact">
<li>a parameter of <a href="../Data/index.htm"><i>DbManager</i></a> type. In this case generator uses provided <a href="../Data/index.htm"><i>DbManager</i></a> to call the command.</li>
<li>parameters decorated with attribute <i>FormatAttribute</i>.</li>
</ul></div>
</p>
AbstractAccessor.cs
<% ..\..\..\HowTo\DataAccess\AbstractAccessor.cs %>
<a name='Person'></a>
Person.cs
<% ..\..\..\HowTo\DataAccess\Person.cs %>
Gender.cs
<% ..\..\..\HowTo\DataAccess\Gender.cs %>
App.config
<% Doc\Data\App.config %>
<a href="../Data/CreateSql.htm">Create.sql script</a>