,
coach sneakers
| Back to logs list
133406 2008 年 09 月 21 日 17:15 Reading (loading. ..) Comments (0) Category: C #
using System.Collections.Generic;
using System.Text;
using ;
using ;
namespace
{
public static partial class
{
; public static Add ( )
{
0)
{
foreach (TableKeySchema key in TargetTable.ForeignKeys)
{
; if (key.PrimaryKeyTable.ExtendedProperties.Contains (if ( . == null)
{
; . = . GetDefault ();
}
return . Add ();
}
public static void Delete ( )
{
. Delete ();
}
; public static void Delete ById ( )
{
. Delete ById ();
}
public static void Modify ( )
{
. Modify ();
}
;
public static IList <> GetAll ()
{
return . GetAll ();
;}
public static Get By ( )
{
return . Get By ();
}
<%
if (TargetTable.ExtendedProperties . Contains (TargetTable.ExtendedProperties [; public static GetDefault ()
{
return Get ById ();
}
}
}
/ / result = table.Name.Substring (0, table.Name.Length - 1);
result = MakeSingle (table.Name);
}
else
{
result = table.Name;
}
return MakePascal (result);
}
//////////// / / //////////////////////////////////////////////// / br> / / PRIMARY KEY TYPE by Shen Bo
/////////////////////////////////// / / //////////////////////////
public string GetPKPropertyType ()
{
return GetPKType (TargetTable);
}
public string GetPKType ()
{
return GetPKType (TargetTable);
}
public string GetPKType (TableSchema TargetTable)
{
if (TargetTable.PrimaryKey! = null)
{
if (TargetTable.PrimaryKey.MemberColumns.Count == 1)
{
return GetCSharpTypeFromDBFieldType (TargetTable.PrimaryKey.MemberColumns [0]);
}
else
{
throw new ApplicationException (template will not work on primary keys with more than one member column.; This template will only work on MyTables with a primary key. case DbType.AnsiStringFixedLength: return;;
case DbType.Byte: return return DbType.Double: return; case DbType.Int32: return
case DbType.SByte: return; string UInt16: return; case DbType.VarNumeric: return;}
}
}
/////////////////////////////////// ///////////// ///////////////
/ / PRIMARY KEY NAME by Shen Bo
//////// ///////////// ///////////////////////////////////// /////
public string GetPKPropertyName ()
{
return MakePascal (GetPKName ());
}
public string GetPKMemberVarName ()
{
return MakeCamel (GetPKName ());
}
public string GetPKParamName ()
{
return GetPKMemberVarName ();
}
public string GetPKName ()
{
return GetPKName (TargetTable);
}
public string GetPKName (TableSchema TargetTable)
{
if (TargetTable.PrimaryKey! = null)
{
if (TargetTable.PrimaryKey. MemberColumns.Count == 1)
{
return TargetTable . PrimaryKey.MemberColumns [0]. Name;
}
else
{
throw new ApplicationException (br>}
else
{
throw new ApplicationException (>
/////////////////////////////////////////// / / / /////////////////
/ / FOREIGH KEY PROPERTY TYPE by Shen Bo
/////////////// / / / /////////////////////////////////////////////
public string GetFKPropertyType (TableKeySchema key)
{
return MakePascal (GetFKPrimaryModelClassName (key));
}
/////////////////// / / / /////////////////////////////////////////
/ / FOREIGH KEY ID NAMEs by Shen Bo
///////////////////////////////////////// / / / ///////////////////
public string GetFKForeignIdName (TableKeySchema key)
{
return key.ForeignKeyMemberColumns [0]. Name;
}
public string GetFKPrimaryIdName (TableKeySchema key)
{
return key.PrimaryKeyMemberColumns [0]. Name;
}
///////////// / / / ///////////////////////////////////////////////
/ / FOREIGH KEY PROPERTY NAME by Shen Bo
/////////////////////////////////// / / / /////////////////////////
public string GetFKMemberVarName (TableKeySchema key)
{
/ / return MakeCamel (GetFKName (key ));
string result = GetFKForeignIdName (key);
if (result.ToLower (). EndsWith (. Substring (0, result.Length - 2);
}
return MakeCamel (result );
}
public string GetFKPropertyName (TableKeySchema key)
{
return MakePascal (GetFKMemberVarName (key));
}
public string GetFKPrimaryModelClassName (TableKeySchema key)
{
return GetModelClassName (key.PrimaryKeyTable);
}
/ / So dirty function,
松花湖丰满大坝开闸泄洪 - Qzone日志,
coach bags! - reviewed by shenbo
public string MakeCamel (string value)
{
return value.Substring ( 0, 1). ToLower () + value.Substring (1);
}
/ / I will be dirty too! - coded by shenbo
public string MakePascal (string value)
{
return value.Substring (0,
coach sunglasses outlet, 1). ToUpper () + value.Substring (1);
}
public string MakePlural (string name)
{
Regex plural1 = new Regex ( new Regex (Regex plural4 = new Regex (else if (plural3.IsMatch (name))
return plural3.Replace (name,
coach outlet, return plural4.Replace (name,
coach outlet online, = new Regex (;
Regex plural3 = new Regex ( s $ IsMatch (name))
return plural2.Replace (name,
做人新版本 - Qzone日志, plural3.Replace (name,
见与不见 - Qzone日志,
coach wallet,;);
return name;
}
public override string GetFileName ()
{
return this.GetDALClassName () + void PrintHeader ()
{
Response.WriteLine (========================== ===; BoBoARTS.CodeMad; Shen Bo (bo.shen @ jb-aptech.com.cn)
Response.WriteLine (==================== =