table_row_user.atcs

来自「.net samples」· ATCS 代码 · 共 106 行

ATCS
106
字号
<#--
	User TableRow template.
--##>
<#@ Imports
using System;
using TwoLKit.nTierBuilder.Api.DbDom;
##>
<#@ InstanceMembers
	private ITable Table
	{
		get { return (ITable)Environment["Table"]; }
	}

	public override bool RewriteExistingFile
	{
		get { return false; }
	}

	public override string RelativeFilePath
	{
		get { return GetTableRowClassName(Table) + ".vb"; }
	}
	
	private string GetTableRowClassName(ITable table)
	{
		return table.CodeName + "Row";
	}
	
	private string GetClassName()
	{
		return GetTableRowClassName(Table);
	}

	private string GetPropertyName(IColumn column)
	{
		return SharedUtils.GetPropertyName(column.CodeName);
	}

	private void WriteParameterList(bool includeTypes, string indent)
	{
		bool firstItem = true;
		foreach(IColumn column in Table.Columns)
		{
			if(firstItem)
				firstItem = false;
			else
			{
				Writer.WriteLine(',');
				Writer.Write(indent);
			}

			if(includeTypes)
			{
				Writer.Write(GetDotNetTypeName(column));
				Writer.Write(' ');
			}
			Writer.Write(GetParameterName(column));
		}
	}
	
	private string GetDotNetTypeName(IColumn column)
	{
		return SharedUtils.GetCSharpTypeName(SharedUtils.GetDotNetType(column, false));
	}
	
	private string GetParameterName(IColumn column)
	{
		return Char.ToLower(column.CodeName[0]) + column.CodeName.Substring(1);
	}
	
	private string GetNamespace()
	{
		return SharedUtils.GetDbTierNamespace(Table.Database);
	}
##>
' <fileinfo name="<#= RelativeFilePath #>">
'		<copyright owner="<#= Environment["CopyrightOwner"] #>">
'			All Rights Reserved.
'		</copyright>
'		<remarks>
'			You can update this source code manually. If the file
'			already exist it will not be rewrited by the generator.
'		</remarks>
'		<generator rewritefile="<#= RewriteExistingFile #>" infourl="http://www.2LKit.com">2LKit nTier Builder</generator>
'		<created><#= DateTime.Now.ToString("f") #></created>
' </fileinfo>

Option Strict Off
Option Explicit On

Imports System

'' <summary>
'' Represents a record in the '<#= Table.CodeName #>' table.
'' </summary>
Public Class <#= GetClassName() #>
		Inherits <#= GetClassName() #>_Base
	'' <summary>
	'' Initializes a new instance of the <#= GetClassName() #> class.
	'' </summary>
	Public Sub New()
		MyBase.New()
		' EMPTY
	End Sub
End Class

⌨️ 快捷键说明

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