⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codestructure_net.htm

📁 LLBLGen_v1.21_Final_Doc。 这个是和LLBLGen_v1.21_Final_src配套的文档
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
<TITLE>LLBLGen::Structure of the .NET code</TITLE>
<link rel="STYLESHEET" type="text/css" href="general.css">
</HEAD>
<BODY>
<br>
<h2>LLBLGen::Structure of the .NET code</h2>
<p>
	LLBLGen generates two types of source code: .NET code (in C# or VB.NET) and T-SQL code. The T-SQL code contains
	the generated stored procedures, the .NET code the classes which call and use these stored procedures. Because
	LLBLGen first generates all possible stored procedures and then the .NET class based on which stored procedures 
	are generated, it's necessary to first read about the <a href="codestructure_tsql.htm">Structure of T-SQL code</a> and
	then this page. 
</p>
<h3>The .NET code generator</h3>
<p>
	As described in <a href="codestructure_tsql.htm">Structure of T-SQL code</a>, LLBLGen generates per table and
	view stored procedures, based on the definitions of the fields in those tables and views. Per table and view
	LLBLGen also generates a .NET class in C# or VB.NET. In these classes LLBLGen will generate for each generated 
	stored procedure a method with similar name, which is used to call the stored procedure. Also, for each field in
	the table, LLBLGen will generate a read/write property and several other properties, depending on the selected
	options in the <a href="gui_netcode.htm">GUI</a>. LLBLGen will generate an abstract base class which is used to derive
	the classes per table / view from and which holds shared logic between all the classes of the data-access tier.
	If the user selects the generation of the ConnectionProvider class, LLBLGen will generate this class also, plus
	will embed support for instances of this class in all other generated classes. The ConnectionProvider class is
	used to share an open SqlConnection among data-access tier classes to use ability to execute multiple calls
	of stored procedures in one ADO.NET transaction, without the necessity of hassling with bare SqlConnection objects
	on a higher level. See <a href="ref_connectionprovider.htm">ConnectionProvider class</a> for details.
	<br><br>
	Below are first the possible properties of the base class and the generated table / view classes and after that 
	the descriptions of the generated methods of both the base class and the generated table / view classes. 
	All properties and methods have information when they're generated, what they're for and how possible options in
	the GUI can influence the presence of these properties and methods and their behaviour. 
</p>
<h4>The properties of the generated classes</h4>
<p>
	All properties possible of a table / view class are described here. The properties and methods of the ConnectionProvider
	class are described here: <a href="ref_connectionprovider.htm">ConnectionProvider class</a>. Prefixes of properties
	are only added to the name of the property when Hungarian Coding style is selected plus the option to prefix properties
	is selected. See <a href="gui_netcode.htm">GUI: .NET code tab</a> for details.
	<br><br>
	<b class="SmallHdr">[prefix]MainConnectionProvider</b>
	<table width="100%" cellpadding="2" cellspacing="0" border="1" ID="Table1">
	<tr>
		<td valign="top" width="140"><b>When generated</b></td>
		<td>When 'Include Connection Provider Object support' is checked on the <a href="gui_netcode.htm">.NET code tab</a>.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Type</b></td>
		<td>[Class prefix]ConnectionProvider</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Purpose</b></td>
		<td>
			By setting this property with an instance of the [Class prefix]ConnectionProvider class, all methods of the
			table / view class with use the SqlConnection object of that instance of the [Class prefix]ConnectionProvider class, 
			instead of using a new SqlConnection object each time a method is called.
		</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Read / Write</b></td>
		<td>Write only.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Declared where</b></td>
		<td>[Class prefix]DBInteractionBase class.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Hungarian Prefix</b></td>
		<td>cp</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Accepts Null / DBNull</b></td>
		<td>No</td>
	</tr>
	</table>
	<br clear="all"><br>
	<b class="SmallHdr">[prefix]ErrorCode</b>
	<table width="100%" cellpadding="2" cellspacing="0" border="1" ID="Table2">
	<tr>
		<td valign="top" width="140"><b>When generated</b></td>
		<td>When 'Include ErrorCode' is checked on the <a href="gui_tsqlcode.htm">T-SQL code tab</a>.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Type</b></td>
		<td>SqlInt32</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Purpose</b></td>
		<td>Holds the returned @@ERROR value by the stored procedure, after a call of a method in a table / view class.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Read / Write</b></td>
		<td>Read only.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Declared where</b></td>
		<td>[Class prefix]DBInteractionBase class.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Hungarian Prefix</b></td>
		<td>i</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Accepts Null / DBNull</b></td>
		<td>Not applicable (readonly property).</td>
	</tr>
	</table>
	<br clear="all"><br>
	<b class="SmallHdr">[prefix]ConnectionString</b>
	<table width="100%" cellpadding="2" cellspacing="0" border="1" ID="Table3">
	<tr>
		<td valign="top" width="140"><b>When generated</b></td>
		<td>When 'Using a property' is checked under 'Connection String retrieval settings' 
			on the <a href="gui_netcode.htm">.NET code tab</a>.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Type</b></td>
		<td>string (C#) or String (VB.NET)</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Purpose</b></td>
		<td>Used to pass the connection string value to the table / view class so a method call which uses
			a new SqlConnection object, will be using this string as the connection string. It's not necessary
			to pass this string before each call, but it is necessary to pass a value to this property
			after each time a new instance of a table / view class is created.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Read / Write</b></td>
		<td>Read and Write</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Declared where</b></td>
		<td>[Class prefix]DBInteractionBase class.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Hungarian Prefix</b></td>
		<td>s</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Accepts Null / DBNull</b></td>
		<td>Accepts null (C#) / Nothing (VB.NET), allthough this will render the instance of the class useless since
			no connection string is known so no database connection can be made.</td>
	</tr>
	</table>
	<br clear="all"><br>
	<b class="SmallHdr">[prefix]RowsAffected</b>
	<table width="100%" cellpadding="2" cellspacing="0" border="1" ID="Table19">
	<tr>
		<td valign="top" width="140"><b>When generated</b></td>
		<td>Always.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Type</b></td>
		<td>int (C#) or Integer (VB.NET)</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Purpose</b></td>
		<td>Holds the number which reflects the amount of rows affected by the last executed Insert/Delete/Update statement on the table
		    corresponding with the inheriting class. Is -1 when Include NOCOUNT is checked or a Select statement is run.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Read / Write</b></td>
		<td>Read only.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Declared where</b></td>
		<td>[Class prefix]DBInteractionBase class.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Hungarian Prefix</b></td>
		<td>i</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Accepts Null / DBNull</b></td>
		<td>Not applicable (readonly property).</td>
	</tr>
	</table>
	<br clear="all"><br>
	<b class="SmallHdr">[prefix]<i>FieldName</i></b>
	<table width="100%" cellpadding="2" cellspacing="0" border="1" ID="Table4">
	<tr>
		<td valign="top" width="140"><b>When generated</b></td>
		<td>Always.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Type</b></td>
		<td>Depends on the SQLServer type of <i>FieldName</i>. See for a list: 
			<a href="ref_types.htm">SQLServer, .NET type relations</a></td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Purpose</b></td>
		<td>To set values for input parameters, to hold a returned Identity value when <i>FieldName</i> is an Identity field,
			and to hold the value in the selected row when the SelectOne() and SelectOneW<i>UniqueField</i>Logic() methods
			are called.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Read / Write</b></td>
		<td>Read and Write</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Declared where</b></td>
		<td>[Class prefix]<i>TableName / ViewName</i> class.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Hungarian Prefix</b></td>
		<td>Depends on the SQLServer type of <i>FieldName</i>. See for a list: 
			<a href="ref_types.htm">SQLServer, .NET type relations</a></td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Accepts Null / DBNull</b></td>
		<td>Accepts System.Data.SqlTypes.<i>Type</i>.Null, when <i>FieldName</i> is NULLable in SQLServer.</td>
	</tr>
	</table>
	<br clear="all"><br>
	<b class="SmallHdr">[prefix]<i>FieldName</i>Old</b>
	<table width="100%" cellpadding="2" cellspacing="0" border="1" ID="Table12">
	<tr>
		<td valign="top" width="140"><b>When generated</b></td>
		<td>When LLBLGen generates a stored procedure <br><b>[SP prefix]<i>TableName</i>_UpdateW<i>ForeignKeyField</i>Logic</b>. See
			<a href="codestructure_tsql.htm">Structure of T-SQL code</a> for details about that stored procedure. 
			<i>FieldName</i> is the <i>ForeignKeyField</i>.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Type</b></td>
		<td>Depends on the SQLServer type of <i>FieldName</i>. See for a list: 
			<a href="ref_types.htm">SQLServer, .NET type relations</a></td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Purpose</b></td>
		<td>To set values for the 'old' value input parameter.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Read / Write</b></td>
		<td>Read and Write, allthough this property is never filled with a value, so effectively Write Only.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Declared where</b></td>
		<td>[Class prefix]<i>TableName / ViewName</i> class.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Hungarian Prefix</b></td>
		<td>Depends on the SQLServer type of <i>FieldName</i>. See for a list: 
			<a href="ref_types.htm">SQLServer, .NET type relations</a></td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Accepts Null / DBNull</b></td>
		<td>Accepts System.Data.SqlTypes.<i>Type</i>.Null, when <i>FieldName</i> is NULLable in SQLServer.</td>
	</tr>
	</table>
</p>
<h4>The methods of the generated classes</h4>
<p>
	All methods possible of a table / view class are described here. The generated table / view classes implement
	the interface ICommonDBAccess, which is described here: <a href="ref_icommondbaccess.htm">ICommonDBAccess interface</a>.
	Besides these methods, LLBLGen will generate other methods, depending on the options selected by the User.
	All methods follow the 'set properties, then call the method'-principle often found in other parts of the .NET API, and
	therefor almost never have a parameter list. LLBLGen will generate detailed comments for each generated method, when the
	option 'Include Comments' is selected on the <a href="gui_netcode.htm">.NET Code tab</a>. These comments hold all information
	about which properties are necessary for input, which properties are filled with values when a call to the method was
	succesful, what the method does and other necessary remarks. Use the Visual Studio.NET documentation generator for C#
	to generate the documentation using these comments, or use a free tool like NDoc.
	<br clear="all"><br>
	<b class="SmallHdr">Insert</b>
	<table width="100%" cellpadding="2" cellspacing="0" border="1" ID="Table5">
	<tr>
		<td valign="top" width="140"><b>When generated</b></td>
		<td>When the stored procedure <b>[SP prefix]<i>TableName</i>_Insert</b> is generated.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Return Type</b></td>
		<td>bool (C#) or Boolean (VB.NET)</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Return Type desc.</b></td>
		<td><b>True</b> if the method succeeded, <b>false</b> otherwise. When an error occures, the method will throw an exception, which
			is the exception caught encapsulated in a new Exception exception.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Purpose</b></td>
		<td>For calling the stored procedure <b>[SP prefix]<i>TableName</i>_Insert</b>.</td>
	</tr>
	<tr>
		<td valign="top" width="140"><b>Declared where</b></td>
		<td>[Class prefix]<i>Table / View Name</i> class. This method is part of the ICommonDBAccess interface.
			When this method is not generated in the table / view class, the virtual method <i>Insert</i>, declared in the
			[Class prefix]DBInteractionBase class, is still present, but is an empty method.</td>
	</tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -