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

C# Data.ForeignKeyConstraint类代码示例

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

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



ForeignKeyConstraint类属于System.Data命名空间,在下文中一共展示了ForeignKeyConstraint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: run

	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;

		DataTable dtParent = GHTUtils.DataProvider.CreateParentDataTable();
		DataTable dtChild = GHTUtils.DataProvider.CreateChildDataTable();
		
		ForeignKeyConstraint fc = null;
		fc = new ForeignKeyConstraint("myForeignKey",dtParent.Columns[0],dtChild.Columns[0]);

		try
		{
			BeginCase("Ctor");
			Compare(fc == null ,false );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}

		try
		{
			BeginCase("Ctor - name");
			Compare(fc.ConstraintName  ,"myForeignKey" );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
	}
开发者ID:nlhepler,项目名称:mono,代码行数:38,代码来源:ForeignKeyConstraint_ctor_SDclmDclm.cs


示例2: run

	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;

		DataTable dtParent = GHTUtils.DataProvider.CreateParentDataTable();
		DataTable dtChild = GHTUtils.DataProvider.CreateChildDataTable();
		
		ForeignKeyConstraint fc = null;
		fc = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);

		try
		{
			BeginCase("ToString - default");
			Compare(fc.ToString(), string.Empty );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}

		fc = new ForeignKeyConstraint("myConstraint",dtParent.Columns[0],dtChild.Columns[0]);
		try
		{
			BeginCase("Tostring - Constraint name");
			Compare(fc.ToString(), "myConstraint");
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}	

	}
开发者ID:nlhepler,项目名称:mono,代码行数:40,代码来源:ForeignKeyConstraint_ToString.cs


示例3: run

	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;
		DataSet ds = new DataSet();
		DataTable dtParent = GHTUtils.DataProvider.CreateParentDataTable();
		DataTable dtChild = GHTUtils.DataProvider.CreateChildDataTable();
		ds.Tables.Add(dtParent);
		ds.Tables.Add(dtChild);
		dtParent.PrimaryKey = new DataColumn[] {dtParent.Columns[0]};
		ds.EnforceConstraints = true;

		ForeignKeyConstraint fc1,fc2;
		fc1 = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);

		fc2 = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[1]);
		try
		{
			BeginCase("different columnn");
			Compare(fc1.Equals(fc2),false);
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}

		//Two System.Data.ForeignKeyConstraint are equal if they constrain the same columns.
		try
		{
			BeginCase("same column");
			fc2 = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);
			Compare(fc1.Equals(fc2),true);
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
	}
开发者ID:nlhepler,项目名称:mono,代码行数:45,代码来源:ForeignKeyConstraint_Equals_O.cs


示例4: run

	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;

		DataTable dtParent = GHTUtils.DataProvider.CreateParentDataTable();
		DataTable dtChild = GHTUtils.DataProvider.CreateParentDataTable();
		
		ForeignKeyConstraint fc = null;
		fc = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);

		PropertyCollection pc = fc.ExtendedProperties ;
        
		try
		{
			base.BeginCase("Checking ExtendedProperties default ");
			base.Compare(fc != null,true);
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
		

		try
		{
			base.BeginCase("Checking ExtendedProperties count ");
			base.Compare(pc.Count ,0);
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
	}
开发者ID:nlhepler,项目名称:mono,代码行数:41,代码来源:ForeignKeyConstraint_extendedProperties.cs


示例5: run

	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;
		//int RowCount;
		DataSet ds = new DataSet();
		DataTable dtParent = GHTUtils.DataProvider.CreateParentDataTable();
		DataTable dtChild = GHTUtils.DataProvider.CreateChildDataTable();
		ds.Tables.Add(dtParent);
		ds.Tables.Add(dtChild);
		
		ForeignKeyConstraint fc = null;
		fc = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);

		try
		{
			BeginCase("Columns");
			Compare(fc.Columns[0]  ,dtChild.Columns[0] );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}

		try
		{
			BeginCase("Columns count");
			Compare(fc.Columns.Length ,1 );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
	}
开发者ID:nlhepler,项目名称:mono,代码行数:41,代码来源:ForeignKeyConstraint_Columns.cs


示例6: run

	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;

		DataSet ds = new DataSet();
		DataTable dtParent = GHTUtils.DataProvider.CreateParentDataTable();
		DataTable dtChild = GHTUtils.DataProvider.CreateChildDataTable();
		ds.Tables.Add(dtParent);
		ds.Tables.Add(dtChild);
		
		ForeignKeyConstraint fc = null;
		fc = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);

		try
		{
			BeginCase("default ");
			Compare(fc.ConstraintName ,string.Empty );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}

		fc.ConstraintName  = "myConstraint";

		try
		{
			BeginCase("set/get ");
			Compare(fc.ConstraintName ,"myConstraint" );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
	}
开发者ID:nlhepler,项目名称:mono,代码行数:43,代码来源:ForeignKeyConstraint_constraintName.cs


示例7: AddForeignKeyConstraint

    public static void AddForeignKeyConstraint( DataSet ds )
    {
        DataColumn            parent = ds.Tables["Categories"].Columns["CategoryID"] ;
        DataColumn            child  = ds.Tables["Products"].Columns["CategoryID"] ;

        ForeignKeyConstraint  fk = new ForeignKeyConstraint ( "FK_Product_CategoryID" , parent , child ) ;

        fk.UpdateRule = Rule.Cascade ;
        fk.DeleteRule = Rule.SetNull ;

        // Create the constraint
        // If this fails, you have a row in the products table with no associated category
        ds.Tables["Products"].Constraints.Add ( fk ) ;
    }
开发者ID:alannet,项目名称:example,代码行数:14,代码来源:ManufacturedDataSet.cs


示例8: foreach

 internal DesignRelation this[ForeignKeyConstraint constraint]
 {
     get
     {
         if (constraint != null)
         {
             foreach (DesignRelation relation in this)
             {
                 if (relation.ForeignKeyConstraint == constraint)
                 {
                     return relation;
                 }
             }
         }
         return null;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:DesignRelationCollection.cs


示例9: Main

        static void Main(string[] args)
        {
            DataSet shopDB = new DataSet("ShopDB");
            DataTable orders = new DataTable("Orders");
            DataTable customers = new DataTable("Customers");

            string conStr = @"Data Source=(localdb)\MSSQLLocalDB; Initial Catalog=ShopDB; Integrated Security=True;"; // создание строки подключения

            using (SqlConnection connection = new SqlConnection(conStr))
            {
                connection.Open();

                SqlCommand customersCmd = new SqlCommand("SELECT CustomerNo, LName, FName, Address1, Phone FROM Customers", connection);
                SqlCommand ordersCmd = new SqlCommand("SELECT OrderID, CustomerNo, OrderDate FROM Orders", connection);

                SqlDataReader ordersReader = ordersCmd.ExecuteReader(); // получение DataReader для таблицы OrderDetails

                // метод LoadWithSchema позволяет на основе объекта DataReader создать объект DataTable 
                //с ограничениями для столбцов как в базе данных и заполнить эту таблицу данными
                orders.LoadWithSchema(ordersReader);
                ordersReader.Close();

                SqlDataReader customersReader = customersCmd.ExecuteReader();
                customers.LoadWithSchema(customersReader);
                customersReader.Close();
            }







            customers.PrimaryKey = new DataColumn[] { customers.Columns[0] };

            shopDB.Tables.AddRange(new DataTable[] { customers, orders });
            // создание ограничения ForeignKeyConstraint для таблицы OrderDetails
            var FK_CustomersOrders = new ForeignKeyConstraint(customers.Columns["CustomerNo"], orders.Columns["CustomerNo"]);
            orders.Constraints.Add(FK_CustomersOrders);

            

            
            
            Console.ReadKey();
        }
开发者ID:master-vk,项目名称:Tasks-ITVDN,代码行数:46,代码来源:Program.cs


示例10: Columns

		[Test] public void Columns()
		{
			//int RowCount;
			DataSet ds = new DataSet();
			DataTable dtParent = DataProvider.CreateParentDataTable();
			DataTable dtChild = DataProvider.CreateChildDataTable();
			ds.Tables.Add(dtParent);
			ds.Tables.Add(dtChild);

			ForeignKeyConstraint fc = null;
			fc = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);

			// Columns
			Assert.AreEqual(dtChild.Columns[0] , fc.Columns[0]  , "FKC1");

			// Columns count
			Assert.AreEqual(1 , fc.Columns.Length , "FKC2");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:18,代码来源:ForeignKeyConstraintTest2.cs


示例11: ForeignKeyProviderBase

        public ForeignKeyProviderBase(ITablePopulator foreignTable, ForeignKeyConstraint foreignKey)
        {
            if (foreignTable == null)
                throw new ArgumentNullException("foreignTable");
            if (foreignKey == null)
                throw new ArgumentNullException("foreignKey");
            this.foreignTable = foreignTable;
            this.foreignKey = foreignKey;

            isNullable = true;
            foreach (DataColumn column in foreignKey.Columns)
            {
                if (!column.AllowDBNull)
                {
                    isNullable = false;
                    break;
                }
            }
        }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:19,代码来源:ForeignKeyProviderBase.cs


示例12: Ctor1

		public void Ctor1 ()
		{
			DataTable Table =  _ds.Tables [0];
			
			AssertEquals ("test#01", 0, Table.Constraints.Count);
			Table =  _ds.Tables [1];
			AssertEquals ("test#02", 0, Table.Constraints.Count);
			
			// ctor (string, DataColumn, DataColumn
			ForeignKeyConstraint Constraint = new ForeignKeyConstraint ("test", _ds.Tables [0].Columns [2], _ds.Tables [1].Columns [0]);
			Table = _ds.Tables [1];
			Table.Constraints.Add (Constraint);
			
			AssertEquals ("test#03", 1, Table.Constraints.Count);
			AssertEquals ("test#04", "test", Table.Constraints [0].ConstraintName);
			AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());

			Table = _ds.Tables [0];
			AssertEquals ("test#06", 1, Table.Constraints.Count);
			AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
			AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:22,代码来源:ForeignKeyConstraintTest.cs


示例13: Equals

		[Test] public void Equals()
		{
			DataSet ds = new DataSet();
			DataTable dtParent = DataProvider.CreateParentDataTable();
			DataTable dtChild = DataProvider.CreateChildDataTable();
			ds.Tables.Add(dtParent);
			ds.Tables.Add(dtChild);
			dtParent.PrimaryKey = new DataColumn[] {dtParent.Columns[0]};
			ds.EnforceConstraints = true;

			ForeignKeyConstraint fc1,fc2;
			fc1 = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);

			fc2 = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[1]);
			// different columnn
			Assert.AreEqual(false, fc1.Equals(fc2), "FKC3");

			//Two System.Data.ForeignKeyConstraint are equal if they constrain the same columns.
			// same column
			fc2 = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);
			Assert.AreEqual(true, fc1.Equals(fc2), "FKC4");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:22,代码来源:ForeignKeyConstraintTest2.cs


示例14: Ctor1

		public void Ctor1 ()
		{
			DataTable Table =  _ds.Tables [0];
			
			Assert.AreEqual (0, Table.Constraints.Count, "test#01");
			Table =  _ds.Tables [1];
			Assert.AreEqual (0, Table.Constraints.Count, "test#02");
			
			// ctor (string, DataColumn, DataColumn
			ForeignKeyConstraint Constraint = new ForeignKeyConstraint ("test", _ds.Tables [0].Columns [2], _ds.Tables [1].Columns [0]);
			Table = _ds.Tables [1];
			Table.Constraints.Add (Constraint);
			
			Assert.AreEqual (1, Table.Constraints.Count, "test#03");
			Assert.AreEqual ("test", Table.Constraints [0].ConstraintName, "test#04");
			Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");

			Table = _ds.Tables [0];
			Assert.AreEqual (1, Table.Constraints.Count, "test#06");
			Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
			Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:22,代码来源:ForeignKeyConstraintTest.cs


示例15: AddRange

		public void AddRange ()
		{
			_constraint1.ConstraintName = "UK1";
			_constraint2.ConstraintName = "UK12";
                                                                                                    
			ForeignKeyConstraint _constraint3 = new ForeignKeyConstraint ("FK2", _table.Columns [0],
                                        _table2.Columns [0]);
			UniqueConstraint _constraint4 = new UniqueConstraint ("UK2", _table2.Columns [1]);
                                                                                                    
			// Add the constraints.
			Constraint [] constraints = {_constraint1, _constraint2};
			_table.Constraints.AddRange (constraints);
                                                                                                                                                                                                         
			Constraint [] constraints1 = {_constraint3, _constraint4};
			_table2.Constraints.AddRange (constraints1);
                                                                                                    
			Assert.AreEqual ("UK1", _table.Constraints [0].ConstraintName, "A1");
			Assert.AreEqual ("UK12", _table.Constraints [1].ConstraintName, "A2");
                                                                                              
			Assert.AreEqual ("FK2", _table2.Constraints [0].ConstraintName, "A3");
			Assert.AreEqual ("UK2", _table2.Constraints [1].ConstraintName, "A4");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:22,代码来源:ConstraintCollectionTest.cs


示例16: AddFkException2

		public void AddFkException2 ()
		{
			//Foreign key rules only work when the tables
			//are apart of the dataset
			DataSet ds = new DataSet ();
			ds.Tables.Add (_table);
			_table2.TableName = "TestTable2";
			ds.Tables.Add (_table2);

			_table.Rows.Add (new object [] {1});
			
			// will need a matching parent value in 
			// _table
			_table2.Rows.Add (new object [] {3}); 
								

			//FKC: no matching parent value
			try {
				ForeignKeyConstraint fkc = new ForeignKeyConstraint (_table.Columns [0],
					_table2.Columns [0]);
				
				_table2.Constraints.Add (fkc);	//should throw			
				Assert.Fail ("B1: Failed to throw ArgumentException.");
			} catch (ArgumentException) {
			} catch (AssertionException exc) {
				throw exc;
			} catch (Exception exc) {
				Assert.Fail ("A1: Wrong Exception type. " + exc.ToString ());
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:30,代码来源:ConstraintCollectionTest.cs


示例17: AddFkException1

		public void AddFkException1 ()
		{
			DataSet ds = new DataSet ();
			ds.Tables.Add (_table);
			_table2.TableName = "TestTable2";
			ds.Tables.Add (_table2);

			_table.Rows.Add (new object [] {1});
			_table.Rows.Add (new object [] {1});

			//FKC: can't create unique constraint because duplicate values already exist
			try {
				ForeignKeyConstraint fkc = new ForeignKeyConstraint (_table.Columns [0],
											_table2.Columns [0]);
				
				_table2.Constraints.Add (fkc);	//should throw			
				Assert.Fail ("B1: Failed to throw ArgumentException.");
			} catch (ArgumentException) {
			} catch (AssertionException exc) {
				throw exc;
			} catch (Exception exc) {
				Assert.Fail ("A1: Wrong Exception type. " + exc.ToString ());
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:24,代码来源:ConstraintCollectionTest.cs


示例18: Add

		Constraint Add (string name, DataColumn[] primaryKeyColumns, DataColumn[] foreignKeyColumns)
		{
			ForeignKeyConstraint fc = new ForeignKeyConstraint (name, primaryKeyColumns, foreignKeyColumns);
			Add (fc);
			return fc;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:ConstraintCollection.cs


示例19: InitClass

 private void InitClass()
 {
     DataSetName = "Map_Info_Tables";
     Prefix = "";
     Namespace = "";
     Locale = new CultureInfo("en-US");
     CaseSensitive = false;
     EnforceConstraints = true;
     tableFeature = new FeatureDataTable();
     Tables.Add(tableFeature);
     tableStreet = new StreetDataTable();
     Tables.Add(tableStreet);
     tableCorporation_Link = new Corporation_LinkDataTable();
     Tables.Add(tableCorporation_Link);
     tablePerson_Link = new Person_LinkDataTable();
     Tables.Add(tablePerson_Link);
     tableSheet_Link = new Sheet_LinkDataTable();
     Tables.Add(tableSheet_Link);
     ForeignKeyConstraint fkc;
     fkc = new ForeignKeyConstraint("Feature_Corp_Link", new DataColumn[]
                                                             {
                                                                 tableFeature.FeatureIDColumn
                                                             }, new DataColumn[]
                                                                    {
                                                                        tableCorporation_Link.FeatureIDColumn
                                                                    });
     tableCorporation_Link.Constraints.Add(fkc);
     fkc.AcceptRejectRule = AcceptRejectRule.None;
     fkc.DeleteRule = Rule.Cascade;
     fkc.UpdateRule = Rule.Cascade;
     fkc = new ForeignKeyConstraint("Feature_Person_Link", new DataColumn[]
                                                               {
                                                                   tableFeature.FeatureIDColumn
                                                               }, new DataColumn[]
                                                                      {
                                                                          tablePerson_Link.FeatureIDColumn
                                                                      });
     tablePerson_Link.Constraints.Add(fkc);
     fkc.AcceptRejectRule = AcceptRejectRule.None;
     fkc.DeleteRule = Rule.Cascade;
     fkc.UpdateRule = Rule.Cascade;
     fkc = new ForeignKeyConstraint("Feature_Sheet_Link", new DataColumn[]
                                                              {
                                                                  tableFeature.FeatureIDColumn
                                                              }, new DataColumn[]
                                                                     {
                                                                         tableSheet_Link.FeatureIDColumn
                                                                     });
     tableSheet_Link.Constraints.Add(fkc);
     fkc.AcceptRejectRule = AcceptRejectRule.None;
     fkc.DeleteRule = Rule.Cascade;
     fkc.UpdateRule = Rule.Cascade;
     relationFeature_Corp_Link = new DataRelation("Feature_Corp_Link", new DataColumn[]
                                                                           {
                                                                               tableFeature.FeatureIDColumn
                                                                           }, new DataColumn[]
                                                                                  {
                                                                                      tableCorporation_Link.FeatureIDColumn
                                                                                  }, false);
     Relations.Add(relationFeature_Corp_Link);
     relationFeature_Person_Link = new DataRelation("Feature_Person_Link", new DataColumn[]
                                                                               {
                                                                                   tableFeature.FeatureIDColumn
                                                                               }, new DataColumn[]
                                                                                      {
                                                                                          tablePerson_Link.FeatureIDColumn
                                                                                      }, false);
     Relations.Add(relationFeature_Person_Link);
     relationFeature_Sheet_Link = new DataRelation("Feature_Sheet_Link", new DataColumn[]
                                                                             {
                                                                                 tableFeature.FeatureIDColumn
                                                                             }, new DataColumn[]
                                                                                    {
                                                                                        tableSheet_Link.FeatureIDColumn
                                                                                    }, false);
     Relations.Add(relationFeature_Sheet_Link);
 }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:77,代码来源:Map_Info_Tables.cs


示例20: Clone

        internal ForeignKeyConstraint Clone(DataTable destination) {
            Debug.Assert(this.Table == this.RelatedTable, "We call this clone just if we have the same datatable as parent and child ");
            int keys = Columns.Length;
            DataColumn[] columns = new DataColumn[keys];
            DataColumn[] relatedColumns = new DataColumn[keys];

            int iDest  =0;

            for (int i = 0; i < keys; i++) {
                DataColumn src = Columns[i];
                iDest = destination.Columns.IndexOf(src.ColumnName);
                if (iDest < 0)
                    return null;
                columns[i] = destination.Columns[iDest];

                src = RelatedColumnsReference[i];
                iDest = destination.Columns.IndexOf(src.ColumnName);
                if (iDest < 0)
                    return null;
                relatedColumns[i] = destination.Columns[iDest];
            }
            ForeignKeyConstraint clone = new ForeignKeyConstraint(ConstraintName, relatedColumns, columns);
            clone.UpdateRule = this.UpdateRule;
            clone.DeleteRule = this.DeleteRule;
            clone.AcceptRejectRule = this.AcceptRejectRule;

            // ...Extended Properties
            foreach(Object key in this.ExtendedProperties.Keys) {
                clone.ExtendedProperties[key]=this.ExtendedProperties[key];
            }

            return clone;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:33,代码来源:ForeignKeyConstraint.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Data.Node类代码示例发布时间:2022-05-26
下一篇:
C# Data.DbContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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