本文整理汇总了C#中ModelRoot类的典型用法代码示例。如果您正苦于以下问题:C# ModelRoot类的具体用法?C# ModelRoot怎么用?C# ModelRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelRoot类属于命名空间,在下文中一共展示了ModelRoot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBody
public static string GetBody(Table table, ModelRoot model)
{
try
{
List<Column> allColumns = new List<Column>();
foreach (Column dc in table.GetColumnsFullHierarchy())
{
if (!(dc.DataType == System.Data.SqlDbType.Binary ||
dc.DataType == System.Data.SqlDbType.Image ||
dc.DataType == System.Data.SqlDbType.NText ||
dc.DataType == System.Data.SqlDbType.Text ||
dc.DataType == System.Data.SqlDbType.Timestamp ||
dc.DataType == System.Data.SqlDbType.Udt ||
dc.DataType == System.Data.SqlDbType.VarBinary ||
dc.DataType == System.Data.SqlDbType.Variant ||
dc.DataType == System.Data.SqlDbType.Money))
{
allColumns.Add(dc);
}
}
if (allColumns.Count != 0)
{
return BuildStoredProcedure(table, model, allColumns);
}
return "";
}
catch (Exception ex)
{
throw new Exception(table.DatabaseName + ": Failed on generation of paging select statement", ex);
}
}
示例2: GetSQLCreateTable
public static string GetSQLCreateTable(ModelRoot model, Table table)
{
StringBuilder sb = new StringBuilder();
string tableName = Globals.GetTableDatabaseName(model, table);
sb.AppendLine("if not exists(select * from sysobjects where name = '" + tableName + "' and xtype = 'U')");
sb.AppendLine("CREATE TABLE [dbo].[" + tableName + "] (");
bool firstLoop = true;
foreach (Reference columnRef in table.Columns)
{
Column column = (Column)columnRef.Object;
if (!firstLoop) sb.AppendLine(",");
else firstLoop = false;
sb.Append(AppendColumnDefinition(column, true, true));
}
AppendModifiedAudit(model, table, sb);
AppendCreateAudit(model, table, sb);
AppendTimestamp(model, table, sb);
sb.AppendLine();
sb.AppendLine(") ON [PRIMARY]");
sb.AppendLine();
return sb.ToString();
}
示例3: SQLSelectBusinessObjectByForeignKeyTemplate
public SQLSelectBusinessObjectByForeignKeyTemplate(ModelRoot model, Relation currentRelation, Table realTable)
{
_model = model;
_currentRelation = currentRelation;
_childTable = (Table)_currentRelation.ChildTableRef.Object;
if (realTable.IsInheritedFrom(_childTable)) _childTable = realTable;
_parentTable = (Table)_currentRelation.ParentTableRef.Object;
}
示例4: SetExistingConnection
public static string SetExistingConnection(ModelRoot root)
{
string connectionString = string.Empty;
while (string.IsNullOrEmpty(connectionString))
{
connectionString = ChooseDatabase();
}
using (Transaction tx = root.Store.TransactionManager.BeginTransaction("SetConnectionString", false))
{
root.ConnectionString = connectionString;
tx.Commit();
}
return connectionString;
}
示例5: AppendFullTemplate
private static void AppendFullTemplate(StringBuilder sb, Table table, ModelRoot model)
{
try
{
sb.AppendLine("if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[" + GetStoredProcedureName(table, model) + "]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)");
sb.AppendLine(" drop procedure [dbo].[" + GetStoredProcedureName(table, model) + "]");
sb.AppendLine("GO");
sb.AppendLine();
sb.AppendLine("SET QUOTED_IDENTIFIER ON");
sb.AppendLine("GO");
sb.AppendLine("SET ANSI_NULLS ON");
sb.AppendLine("GO");
sb.AppendLine();
sb.AppendLine("CREATE PROCEDURE [dbo].[" + GetStoredProcedureName(table, model) + "]");
sb.AppendLine("(");
sb.AppendLine(BuildParameterList(table, model));
sb.AppendLine(")");
sb.AppendLine("AS");
sb.AppendLine("SET NOCOUNT OFF;");
sb.AppendLine();
sb.Append(SQLGeneratedBodyHelper.SQLInsertBusinessObjectBody(table, model));
sb.AppendLine("GO");
sb.AppendLine();
sb.AppendLine("SET QUOTED_IDENTIFIER OFF");
sb.AppendLine("GO");
sb.AppendLine("SET ANSI_NULLS ON");
sb.AppendLine("GO");
sb.AppendLine();
if (model.Database.GrantExecUser != string.Empty)
{
sb.AppendFormat("GRANT EXECUTE ON [dbo].[{0}] TO [{1}]", GetStoredProcedureName(table, model), model.Database.GrantExecUser).AppendLine();
sb.AppendLine("GO");
sb.AppendLine();
}
}
catch (Exception ex)
{
throw;
}
}
示例6: GetSQLCreateAuditTable
public static string GetSQLCreateAuditTable(ModelRoot model, Table table)
{
StringBuilder sb = new StringBuilder();
string tableName = "__AUDIT__" + Globals.GetTableDatabaseName(model, table);
sb.AppendLine("if not exists(select * from sysobjects where name = '" + tableName + "' and xtype = 'U')");
sb.AppendLine("CREATE TABLE [dbo].[" + tableName + "] (");
sb.AppendLine("[__rowid] [INT] NOT NULL IDENTITY,");
sb.AppendLine("[__action] [INT] NOT NULL,");
sb.AppendLine("[__insertdate] [DATETIME] CONSTRAINT [DF__" + table.DatabaseName + "__AUDIT] DEFAULT " + (model.UseUTCTime ? "GetUTCDate()" : "GetDate()") + " NOT NULL,");
ColumnCollection columnList = table.GetColumns();
foreach (Column column in columnList)
{
sb.Append(AppendColumnDefinition(column, false, false, false));
if (columnList.IndexOf(column) < columnList.Count - 1) sb.Append(",");
sb.AppendLine();
}
sb.AppendLine(") ON [PRIMARY]");
sb.AppendLine();
return sb.ToString();
}
示例7: GetOrCreateConnectionString
public static string GetOrCreateConnectionString(ModelRoot root, string diagramName)
{
string connectionString = root.ConnectionString;
while(string.IsNullOrEmpty(connectionString))
{
var dbName = string.Join("", diagramName.Split(' ')) + "Db";
var getOrCreateConnectionDlg = new GetOrCreateConnectionForm(dbName);
if (getOrCreateConnectionDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
switch (getOrCreateConnectionDlg.ConfigurationType)
{
case ConnectionConfigurationType.CreateLocal:
try
{
connectionString = CreateLocalConnection(dbName);
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message + "\nPlease choose a connection.");
connectionString = ChooseDatabase();
}
break;
case ConnectionConfigurationType.ChooseDatabase:
connectionString = ChooseDatabase();
break;
case ConnectionConfigurationType.UseCustomConnection:
connectionString = getOrCreateConnectionDlg.ConnectionString;
break;
}
}
}
using (Transaction tx = root.Store.TransactionManager.BeginTransaction("SetConnectionString", false))
{
root.ConnectionString = connectionString;
tx.Commit();
}
return connectionString;
}
示例8: Equals
protected bool Equals(ModelRoot other)
{
return IntProp == other.IntProp
&& DateTime.Equals(other.DateTime)
&& ModelEnum == other.ModelEnum
&& string.Equals(StrProp, other.StrProp)
&& Equals(SubModel, other.SubModel);
}
示例9: DefinedStoredProcedureSelectCommandExtenderTemplate
public DefinedStoredProcedureSelectCommandExtenderTemplate(ModelRoot model, CustomStoredProcedure currentStoredProcedure)
{
_model = model;
_currentStoredProcedure = currentStoredProcedure;
}
示例10: DomainComponentCollectionExtenderTemplate
public DomainComponentCollectionExtenderTemplate(ModelRoot model, TableComponent currentComponent)
{
_model = model;
_currentComponent = currentComponent;
}
示例11: SQLSelectStoredProcedureTemplate
public SQLSelectStoredProcedureTemplate(ModelRoot model, CustomStoredProcedure currentStoredProcedure)
{
_model = model;
_currentStoredProcedure = currentStoredProcedure;
}
示例12: SQLSelectBusinessObjectTemplate
public SQLSelectBusinessObjectTemplate(ModelRoot model, Table currentTable)
{
_model = model;
_currentTable = currentTable;
}
示例13: DomainObjectGeneratedTemplate
public DomainObjectGeneratedTemplate(ModelRoot model, Table currentTable)
{
_model = model;
_currentTable = currentTable;
}
示例14: ObjectServiceExtenderTemplate
public ObjectServiceExtenderTemplate(ModelRoot model, Table table)
{
_model = model;
_currentTable = table;
}
示例15: DataServiceJSPageHelperTemplate
public DataServiceJSPageHelperTemplate(ModelRoot model)
{
_model = model;
}