• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ModelRoot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ModelRoot的典型用法代码示例。如果您正苦于以下问题:C# ModelRoot类的具体用法?C# ModelRoot怎么用?C# ModelRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ModelRoot类属于命名空间,在下文中一共展示了ModelRoot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
				}
			}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:34,代码来源:SQLGeneratedBodyHelper.cs


示例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();

		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:25,代码来源:SQLGeneration.cs


示例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;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:8,代码来源:SQLSelectBusinessObjectByForeignKeyTemplate.cs


示例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;
 }
开发者ID:jeswin,项目名称:AgileFx,代码行数:14,代码来源:ConnectionUtil.cs


示例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;
			}

		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:42,代码来源:SQLInsertBusinessObjectTemplate.cs


示例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();

		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:22,代码来源:SQLGeneration.cs


示例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;
 }
开发者ID:jeswin,项目名称:AgileFx,代码行数:38,代码来源:ConnectionUtil.cs


示例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);
 }
开发者ID:kilroytrout,项目名称:RedisBoost,代码行数:8,代码来源:IntegrationTestsForGenericMethods.cs


示例9: DefinedStoredProcedureSelectCommandExtenderTemplate

    public DefinedStoredProcedureSelectCommandExtenderTemplate(ModelRoot model, CustomStoredProcedure currentStoredProcedure)
    {
      _model = model;
      _currentStoredProcedure = currentStoredProcedure;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:DefinedStoredProcedureSelectCommandExtenderTemplate.cs


示例10: DomainComponentCollectionExtenderTemplate

		public DomainComponentCollectionExtenderTemplate(ModelRoot model, TableComponent currentComponent)
    {
      _model = model;
      _currentComponent = currentComponent;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:DomainComponentCollectionExtenderTemplate.cs


示例11: SQLSelectStoredProcedureTemplate

 public SQLSelectStoredProcedureTemplate(ModelRoot model, CustomStoredProcedure currentStoredProcedure)
 {
   _model = model;
   _currentStoredProcedure = currentStoredProcedure;
 }
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:SQLSelectStoredProcedureTemplate.cs


示例12: SQLSelectBusinessObjectTemplate

		public SQLSelectBusinessObjectTemplate(ModelRoot model, Table currentTable)
    {
      _model = model;
			_currentTable = currentTable;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:SQLSelectBusinessObjectTemplate.cs


示例13: DomainObjectGeneratedTemplate

		public DomainObjectGeneratedTemplate(ModelRoot model, Table currentTable)
		{
			_model = model;
			_currentTable = currentTable;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:DomainObjectGeneratedTemplate.cs


示例14: ObjectServiceExtenderTemplate

		public ObjectServiceExtenderTemplate(ModelRoot model, Table table)
		{
			_model = model;
			_currentTable = table;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:ObjectServiceExtenderTemplate.cs


示例15: DataServiceJSPageHelperTemplate

		public DataServiceJSPageHelperTemplate(ModelRoot model)
    {
      _model = model;      
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:4,代码来源:DataServiceJSPageHelperTemplate.cs


示例16: GetParentStoredProcedureName

		public static string GetParentStoredProcedureName(Table table, ModelRoot model)
		{
			if (table.ParentTable == null) return "";
			else return "gen_" + Globals.GetPascalName(model, table.ParentTable) + "Insert";
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:SQLInsertBusinessObjectTemplate.cs


示例17: SQLInsertBusinessObjectTemplate

		public SQLInsertBusinessObjectTemplate(ModelRoot model, Table currentTable)
		{
			_model = model;
			table = currentTable;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:SQLInsertBusinessObjectTemplate.cs


示例18: BusinessSQLHelperExtenderTemplate

		public BusinessSQLHelperExtenderTemplate(ModelRoot model)
    {
      _model = model;      
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:4,代码来源:BusinessSQLHelperExtenderTemplate.cs


示例19: SQLSelectComponentByPrimaryKeyTemplate

		public SQLSelectComponentByPrimaryKeyTemplate(ModelRoot model, TableComponent currentComponent)
		{
			_model = model;
			_currentComponent = currentComponent;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:SQLSelectComponentByPrimaryKey.cs


示例20: ObjectListPagesExtenderTemplate

		public ObjectListPagesExtenderTemplate(ModelRoot model, Table currentTable)
    {
      _model = model;
      _currentTable = currentTable;
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:5,代码来源:ObjectListPagesExtenderTemplate.cs



注:本文中的ModelRoot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ModelState类代码示例发布时间:2022-05-24
下一篇:
C# ModelObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap