<% @ Codetemplate Language = "C #" targetlanguage = "T-SQL" DEBUG = "true" compilerversion = "v3.5" Description = "" %>
<% @ Assembly name = "schemaexplorer" %>
<% @ Property name = "sourcetable" type = "schemaexplorer. tableschema" Optional = "false" Category = "required" %>
<% @ Property name = "namespace" Optional = "false" type = "system. string "default =" beyondbit. app. entity "Category =" style "Description =" object namespace. "%>
//----------------------------------------------------------------
// Copy right (c) 2012
//
// All Rights Reserved.
//
// <% = Sourcetable %>. CS
//
//
// Create time: <% = datetime. Now. tostring ("yyyy-mm-dd hh: mm: SS") %>
//
//
//
//----------------------------------------------------------------
Using system;
Using system. Data;
Using system. Collections. Generic;
Using system. text;
Using beyondbit. Framework. biz. entry;
Using beyondbit. Framework. sor. attributes;
<% --
Sourcetable. Columns [I]. extendedproperties []
= Cs_isrowguidcol
= Cs_isidentity
= Cs_iscomputed
= Cs_isdeterministic
= Cs_identityseed
= Cs_identityincrement
= Cs_default
= Cs_computeddefinition
= Cs_collation
= Cs_objectid
= Cs_systemtype
= Cs_usertype
= Ms_description
= Cs_description
-- %>
Namespace <% = namespace %> {
[Serializable]
Public class <% = sourcetable. name %> {
<% For (INT I = 0; I <sourcetable. Columns. Count; ++ I) {%>
///
/// Database Type: <% = sourcetable. Columns [I]. extendedproperties ["cs_systemtype"]. Value %>
///
Private <% = gettypestring (sourcetable. Columns [I]) % >_< % = sourcetable. Columns [I]. name %>;
<%
Bool is_primary = sourcetable. Columns [I]. isprimarykeymember;
Bool is_identity = (sourcetable. Columns [I]. extendedproperties ["cs_isidentity"]. value. tostring () = "true ");
%>
Public <% = gettypestring (sourcetable. Columns [I]) %> <% = sourcetable. Columns [I]. name %> {
Get {
Return _ <% = sourcetable. Columns [I]. name %>;
} Set {
_ <% = Sourcetable. Columns [I]. name %> = value;
}
}
<% }%>
}
}
<SCRIPT runat = "template">
Public String gettypestring (schemaexplorer. columnschema clmn ){
String type = clmn. datatype. tostring ();
Switch (type ){
Case "ansistring ":
Case "string ":
Type = "string ";
Break;
Case "int32 ":
Type = "int ";
Break;
Case "datetime ":
Type = "datetime ";
Break;
Case "double ":
Type = "double ";
Break;
Case "binary ":
Type = "byte []";
Break;
Case "Boolean ":
Type = "bool ";
Break;
Case "decimal ":
Type = "decimal ";
Break;
Case "single ":
Type = "float ";
Break;
Case "currency ":
Type = "decimal ";
Break;
Case "XML ":
Type = "string ";
Break;
Case "ansistringfixedlength ":
Type = "string ";
Break;
Case "float ":
Type = "float ";
Break;
Case "guid ":
Type = "string ";
Break;
Case "Byte ":
Type = "Byte ";
Break;
Default:
// Type = "string ";
Break;
}
Return type;
}
</SCRIPT>