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

C# DataRowAction类代码示例

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

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



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

示例1: taxi_managementDataSet_car_madeRowChangeEventConstructorTest

 public void taxi_managementDataSet_car_madeRowChangeEventConstructorTest()
 {
     taxi_managementDataSet.car_madeRow row = null; // TODO: Initialize to an appropriate value
     DataRowAction action = new DataRowAction(); // TODO: Initialize to an appropriate value
     taxi_managementDataSet.car_madeRowChangeEvent target = new taxi_managementDataSet.car_madeRowChangeEvent(row, action);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
开发者ID:coderogue,项目名称:TaxiManagement,代码行数:7,代码来源:taxi_managementDataSet_car_madeRowChangeEventTest.cs


示例2: RowTest

 public void RowTest()
 {
     taxi_managementDataSet.car_madeRow row = null; // TODO: Initialize to an appropriate value
     DataRowAction action = new DataRowAction(); // TODO: Initialize to an appropriate value
     taxi_managementDataSet.car_madeRowChangeEvent target = new taxi_managementDataSet.car_madeRowChangeEvent(row, action); // TODO: Initialize to an appropriate value
     taxi_managementDataSet.car_madeRow actual;
     actual = target.Row;
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
开发者ID:coderogue,项目名称:TaxiManagement,代码行数:9,代码来源:taxi_managementDataSet_car_madeRowChangeEventTest.cs


示例3: EvaluateExpressions

        internal void EvaluateExpressions(DataRow row, DataRowAction action, List<DataRow> cachedRows) {
            // evaluate all expressions for specified row
            if (action == DataRowAction.Add ||
                action == DataRowAction.Change||
                (action == DataRowAction.Rollback && (row.oldRecord!=-1 || row.newRecord!=-1))) {
                 // only evaluate original values if different from current.
                if (row.oldRecord != -1 && row.oldRecord != row.newRecord) {
                    EvaluateDependentExpressions(dependentColumns, row, DataRowVersion.Original, cachedRows);
                }
                if (row.newRecord != -1) {
                    EvaluateDependentExpressions(dependentColumns, row, DataRowVersion.Current, cachedRows);
                }
                if (row.tempRecord != -1) {
                    EvaluateDependentExpressions(dependentColumns, row, DataRowVersion.Proposed, cachedRows);
                }
                return;
            }
            else if ((action == DataRowAction.Delete || (action==DataRowAction.Rollback && row.oldRecord==-1 && row.newRecord==-1)) && dependentColumns != null) {
                foreach(DataColumn col in dependentColumns) {                    
                    if (col.DataExpression != null && col.DataExpression.HasLocalAggregate() && col.Table == this) {
                        for (int j = 0; j < Rows.Count; j++) {
                            DataRow tableRow = Rows[j];

                            if (tableRow.oldRecord != -1 && tableRow.oldRecord != tableRow.newRecord) {
                                EvaluateDependentExpressions(dependentColumns, tableRow, DataRowVersion.Original, null);
                            }                          
                        }
                        for (int j = 0; j < Rows.Count; j++)
                        {
                            DataRow tableRow = Rows[j];
                         
                            if (tableRow.tempRecord != -1)
                            {
                                EvaluateDependentExpressions(dependentColumns, tableRow, DataRowVersion.Proposed, null);
                            }                           
                        }
                        // VSTFDEVDIV911434: Order is important here - we need to update proposed before current
                        // Oherwise rows that are in edit state will get ListChanged/PropertyChanged event before default value is changed
                        // It is also the reason why we are not doping it in the single loop: EvaluateDependentExpression can update the
                        // whole table, if it happens, current for all but first row is updated before proposed value
                        for (int j = 0; j < Rows.Count; j++)
                        {
                            DataRow tableRow = Rows[j];
                                                     
                            if (tableRow.newRecord != -1)
                            {
                                EvaluateDependentExpressions(dependentColumns, tableRow, DataRowVersion.Current, null);
                            }
                        }
                        break;
                    }
                }

                if (cachedRows != null) {
                    foreach (DataRow relatedRow in cachedRows) {
                        if (relatedRow.oldRecord != -1 && relatedRow.oldRecord != relatedRow.newRecord) {
                            relatedRow.Table.EvaluateDependentExpressions(relatedRow.Table.dependentColumns, relatedRow, DataRowVersion.Original, null);
                        }
                        if (relatedRow.newRecord != -1) {
                            relatedRow.Table.EvaluateDependentExpressions(relatedRow.Table.dependentColumns, relatedRow, DataRowVersion.Current, null);
                        }
                        if (relatedRow.tempRecord != -1) {
                            relatedRow.Table.EvaluateDependentExpressions(relatedRow.Table.dependentColumns, relatedRow, DataRowVersion.Proposed, null);
                        }
                    }
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:68,代码来源:DataTable.cs


示例4: SetNewRecordWorker

        private void SetNewRecordWorker(DataRow row, int proposedRecord, DataRowAction action, bool isInMerge, bool suppressEnsurePropertyChanged,
            int position, bool fireEvent, out Exception deferredException) {

            // this is the event workhorse... it will throw the changing/changed events
            // and update the indexes. Used by change, add, delete, revert.

            // order of execution is as follows
            //
            // 1) set temp record
            // 2) Check constraints for non-expression columns
            // 3) Raise RowChanging/RowDeleting with temp record
            // 4) set the new record in storage
            // 5) Update indexes with recordStateChanges - this will fire ListChanged & PropertyChanged events on associated views
            // 6) Evaluate all Expressions (exceptions are deferred)- this will fire ListChanged & PropertyChanged events on associated views
            // 7) Raise RowChanged/ RowDeleted
            // 8) Check constraints for expression columns

            Debug.Assert(row != null, "Row can't be null.");
            deferredException = null;
            
            if (row.tempRecord != proposedRecord) {
                // $HACK: for performance reasons, EndUpdate calls SetNewRecord with tempRecord == proposedRecord
                if (!inDataLoad) {
                    row.CheckInTable();
                    CheckNotModifying(row);
                }
                if (proposedRecord == row.newRecord) {
                    if (isInMerge) {
                        Debug.Assert(fireEvent, "SetNewRecord is called with wrong parameter");
                        RaiseRowChanged(null, row, action);
                    }
                    return;
                }

                Debug.Assert(!row.inChangingEvent, "How can this row be in an infinite loop?");

                row.tempRecord = proposedRecord;
            }
            DataRowChangeEventArgs drcevent = null;

            try {
                row._action = action;
                drcevent = RaiseRowChanging(null, row, action, fireEvent);
            }
            catch {
                row.tempRecord = -1;
                throw;
            }
            finally {
                row._action = DataRowAction.Nothing;
            }

            row.tempRecord = -1;

            int currentRecord = row.newRecord;

            // if we're deleting, then the oldRecord value will change, so need to track that if it's distinct from the newRecord.
            int secondRecord = (proposedRecord != -1 ?
                                proposedRecord :
                                (row.RowState != DataRowState.Unchanged ?
                                 row.oldRecord :
                                 -1));

            if (action == DataRowAction.Add) { //if we come here from insert we do insert the row to collection
                if (position == -1)
                    Rows.ArrayAdd(row);
                else
                    Rows.ArrayInsert(row, position);
            }

            List<DataRow> cachedRows = null;
            if ((action == DataRowAction.Delete || action == DataRowAction.Change)
                && dependentColumns != null && dependentColumns.Count > 0) {
                // if there are expression columns, need to cache related rows for deletes and updates (key changes)
                // before indexes are modified.
                cachedRows = new List<DataRow>();
                for (int j = 0; j < ParentRelations.Count; j++) {
                    DataRelation relation = ParentRelations[j];
                    if (relation.ChildTable != row.Table) {
                        continue;
                    }
                    cachedRows.InsertRange(cachedRows.Count, row.GetParentRows(relation));
                }

                for (int j = 0; j < ChildRelations.Count; j++) {
                    DataRelation relation = ChildRelations[j];
                    if (relation.ParentTable != row.Table) {
                        continue;
                    }
                    cachedRows.InsertRange(cachedRows.Count, row.GetChildRows(relation));
                }
            }

            // Dev10 Bug 688779: DataRowView.PropertyChanged are not raised on RejectChanges
            // if the newRecord is changing, the propertychanged event should be allowed to triggered for ListChangedType.Changed or .Moved
            // unless the specific condition is known that no data has changed, like DataRow.SetModified()
            if (!suppressEnsurePropertyChanged && !row.HasPropertyChanged && (row.newRecord != proposedRecord)
                && (-1 != proposedRecord) // explictly not fixing Dev10 Bug 692044: DataRowView.PropertyChanged are not raised on DataTable.Delete when mixing current and original records in RowStateFilter
                && (-1 != row.newRecord)) // explictly not fixing parts of Dev10 Bug 697909: when mixing current and original records in RowStateFilter
            {
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:DataTable.cs


示例5: RaiseRowChanging

        private DataRowChangeEventArgs RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction, bool fireEvent) {

            // check all constraints
            if (EnforceConstraints && !inLoad ) {
                int columnCount = columnCollection.Count;
                for(int i = 0; i < columnCount; ++i) {
                    DataColumn column = columnCollection[i];
                    if (!column.Computed || eAction != DataRowAction.Add) {
                        column.CheckColumnConstraint(eRow, eAction);
                    }
                }

                int constraintCount = constraintCollection.Count;
                for(int i = 0; i < constraintCount; ++i) {
                    constraintCollection[i].CheckConstraint(eRow, eAction);
                }
            }

            // $$anandra.  Check this event out. May be an issue.
            if (fireEvent) {
                args = RaiseRowChanging(args, eRow, eAction);
            }

            if (!inDataLoad) {
                // cascade things...
                if (!MergingData && eAction != DataRowAction.Nothing && eAction != DataRowAction.ChangeOriginal) {
                    CascadeAll(eRow, eAction);
                }
            }
            return args;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:31,代码来源:DataTable.cs


示例6: RaiseRowChanged

 private DataRowChangeEventArgs RaiseRowChanged(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction) {
     try {
         if (UpdatingCurrent(eRow, eAction) && (IsTypedDataTable || (null != onRowChangedDelegate))) {
             args = OnRowChanged(args, eRow, eAction);
         }
         // check if we deleting good row
         else if (DataRowAction.Delete == eAction && eRow.newRecord == -1 && (IsTypedDataTable || (null != onRowDeletedDelegate))) {
             if (null == args) {
                 args = new DataRowChangeEventArgs(eRow, eAction);
             }
             OnRowDeleted(args);
         }
     }
     catch (Exception f) {
        // 
        if (!Common.ADP.IsCatchableExceptionType(f)) {
          throw;
        }
        ExceptionBuilder.TraceExceptionWithoutRethrow(f);
        // ignore the exception
     }
     return args;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:DataTable.cs


示例7: CascadeAll

 internal void CascadeAll(DataRow row, DataRowAction action) {
     if (DataSet != null && DataSet.fEnableCascading) {
         for (ParentForeignKeyConstraintEnumerator constraints = new ParentForeignKeyConstraintEnumerator(dataSet, this); constraints.GetNext();) {
             constraints.GetForeignKeyConstraint().CheckCascade(row, action);
         }
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:DataTable.cs


示例8: Corporation_LinkRowChangeEvent

 public Corporation_LinkRowChangeEvent(Corporation_LinkRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:5,代码来源:Map_Info_Tables.cs


示例9: rowActionInit

		private void rowActionInit (DataRowAction[] act)
		{
			checkAction = true;
			rowChagedCounter = 0;
			rowChangingCounter = 0;
			for (int i = 0; i < 5; i++)
				rowChangeAction[i] = act[i];
		}
开发者ID:symform,项目名称:mono,代码行数:8,代码来源:DataTableTest.cs


示例10: AcceptChangesTest

		public void AcceptChangesTest ()
		{
			DataTable dt = new DataTable ("test");
			dt.Columns.Add ("id", typeof (int));
			dt.Columns.Add ("name", typeof (string));

			dt.Rows.Add (new object [] { 1, "mono 1" });

			dt.RowChanged  += new DataRowChangeEventHandler (OnRowChanged);
			dt.RowChanging += new DataRowChangeEventHandler (OnRowChanging);

			try {
				rowActionChanged = rowActionChanging = DataRowAction.Nothing;
				dt.AcceptChanges ();

				Assert.AreEqual (DataRowAction.Commit, rowActionChanging,
						 "#1 should have fired event and set action to commit");
				Assert.AreEqual (DataRowAction.Commit, rowActionChanged,
						 "#2 should have fired event and set action to commit");
			} finally {
				dt.RowChanged  -= new DataRowChangeEventHandler (OnRowChanged);
				dt.RowChanging -= new DataRowChangeEventHandler (OnRowChanging);
			}
		}
开发者ID:symform,项目名称:mono,代码行数:24,代码来源:DataTableTest.cs


示例11: RowChanging

		public void RowChanging ()
		{
			DataTable dt = new DataTable ("table");
			dt.Columns.Add ("col1");
			dt.Columns.Add ("col2");
			dt.RowChanging += new DataRowChangeEventHandler (RowChanging);
			dt.RowChanged += new DataRowChangeEventHandler (RowChanged);
			rowChangingExpectedAction = DataRowAction.Add;
			dt.Rows.Add (new object [] {1, 2});
			Assert.IsTrue (rowChangingRowChanging, "changing,Added");
			Assert.IsTrue (rowChangingRowChanged, "changed,Added");
			rowChangingExpectedAction = DataRowAction.Change;
			dt.Rows [0] [0] = 2;
			Assert.IsTrue (rowChangingRowChanging, "changing,Changed");
			Assert.IsTrue (rowChangingRowChanged, "changed,Changed");
		}
开发者ID:symform,项目名称:mono,代码行数:16,代码来源:DataTableTest.cs


示例12: PermissionsTableRowChangeEvent

 public PermissionsTableRowChangeEvent(PermissionsTableRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
开发者ID:CarverLab,项目名称:Oyster,代码行数:5,代码来源:Permissions.cs


示例13: userantwortselectRowChangeEvent

 public userantwortselectRowChangeEvent(userantwortselectRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
开发者ID:BackupTheBerlios,项目名称:questioncatalog-svn,代码行数:5,代码来源:DSUserantwortselect.cs


示例14: _TableRowChangeEvent

 public _TableRowChangeEvent(_TableRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
开发者ID:yesashii,项目名称:upa,代码行数:5,代码来源:DataSet1.cs


示例15: Sheet_LinkRowChangeEvent

 public Sheet_LinkRowChangeEvent(Sheet_LinkRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:5,代码来源:Map_Info_Tables.cs


示例16: StreetRowChangeEvent

 public StreetRowChangeEvent(StreetRow row, DataRowAction action)
 {
     eventRow = row;
     eventAction = action;
 }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:5,代码来源:Map_Info_Tables.cs


示例17: Load_RowStateOverwriteChanges

		public void Load_RowStateOverwriteChanges ()
		{
			localSetup ();
			dt.Rows.Add (new object[] { 4, "mono 4" });
			dt.Rows.Add (new object[] { 5, "mono 5" });
			dt.AcceptChanges ();
			DataTableReader dtr = dt.CreateDataReader ();
			DataTable dtLoad = setupRowState ();
			DataRowAction[] dra = new DataRowAction[] {
				DataRowAction.ChangeCurrentAndOriginal,
				DataRowAction.ChangeCurrentAndOriginal,
				DataRowAction.ChangeCurrentAndOriginal,
				DataRowAction.ChangeCurrentAndOriginal,
				DataRowAction.ChangeCurrentAndOriginal};
			rowActionInit (dra);
			dtLoad.Load (dtr, LoadOption.OverwriteChanges);
			rowActionEnd ();
			// asserting Unchanged Row0
			Assert.AreEqual ("mono 1", dtLoad.Rows[0][1, DataRowVersion.Current], "RowData0-C");
			Assert.AreEqual ("mono 1", dtLoad.Rows[0][1, DataRowVersion.Original], "RowData0-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[0].RowState, "RowState0");
			// asserting Modified Row1
			Assert.AreEqual ("mono 2", dtLoad.Rows[1][1, DataRowVersion.Current], "RowData1-C");
			Assert.AreEqual ("mono 2", dtLoad.Rows[1][1, DataRowVersion.Original], "RowData1-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[1].RowState, "RowState1");
			// asserting Deleted Row2
			Assert.AreEqual ("mono 3", dtLoad.Rows[2][1, DataRowVersion.Current], "RowData1-C");
			Assert.AreEqual ("mono 3", dtLoad.Rows[2][1, DataRowVersion.Original], "RowData1-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[2].RowState, "RowState2");
			// asserting Added Row3
			Assert.AreEqual ("mono 4", dtLoad.Rows[3][1, DataRowVersion.Current], "RowData3-C");
			Assert.AreEqual ("mono 4", dtLoad.Rows[3][1, DataRowVersion.Original], "RowData3-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[3].RowState, "RowState3");
			// asserting Unpresent Row4
			Assert.AreEqual ("mono 5", dtLoad.Rows[4][1, DataRowVersion.Current], "RowData4-C");
			Assert.AreEqual ("mono 5", dtLoad.Rows[4][1, DataRowVersion.Original], "RowData4-O");
			Assert.AreEqual (DataRowState.Unchanged, dtLoad.Rows[4].RowState, "RowState4");
		}
开发者ID:symform,项目名称:mono,代码行数:38,代码来源:DataTableTest.cs


示例18: SetMergeRecords

 private void SetMergeRecords(DataRow row, int newRecord, int oldRecord, DataRowAction action) {
     if (newRecord != -1) {
         SetNewRecord(row, newRecord, action, true, true);
         SetOldRecord(row, oldRecord);
     }
     else {
         SetOldRecord(row, oldRecord);
         if (row.newRecord != -1) {
             Debug.Assert(action == DataRowAction.Delete, "Unexpected SetNewRecord action in merge function.");
             SetNewRecord(row, newRecord, action, true, true);
         }
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:DataTable.cs


示例19: Load_RowStateUpsert

		public void Load_RowStateUpsert ()
		{
			localSetup ();
			dt.Rows.Add (new object[] { 4, "mono 4" });
			dt.Rows.Add (new object[] { 5, "mono 5" });
			dt.AcceptChanges ();
			DataTableReader dtr = dt.CreateDataReader ();
			DataTable dtLoad = setupRowState ();
			// Notice rowChange-Actions only occur 5 times, as number 
			// of actual rows, ignoring row duplication of the deleted row.
			DataRowAction[] dra = new DataRowAction[] {
				DataRowAction.Change,
				DataRowAction.Change,
				DataRowAction.Add,
				DataRowAction.Change,
				DataRowAction.Add};
			rowActionInit (dra);
			dtLoad.Load (dtr, LoadOption.Upsert);
			rowActionEnd ();
			// asserting Unchanged Row0
			Assert.AreEqual ("mono 1", dtLoad.Rows[0][1, DataRowVersion.Current], "RowData0-C");
			Assert.AreEqual ("RowState 1", dtLoad.Rows[0][1, DataRowVersion.Original], "RowData0-O");
			Assert.AreEqual (DataRowState.Modified, dtLoad.Rows[0].RowState, "RowState0");
			// asserting Modified Row1
			Assert.AreEqual ("mono 2", dtLoad.Rows[1][1, DataRowVersion.Current], "RowData1-C");
			Assert.AreEqual ("RowState 2", dtLoad.Rows[1][1, DataRowVersion.Original], "RowData1-O");
			Assert.AreEqual (DataRowState.Modified, dtLoad.Rows[1].RowState, "RowState1");
			// asserting Deleted Row2 and "Deleted-Added" Row4
			Assert.AreEqual ("RowState 3", dtLoad.Rows[2][1, DataRowVersion.Original], "RowData2-O");
			Assert.AreEqual (DataRowState.Deleted, dtLoad.Rows[2].RowState, "RowState2");
			Assert.AreEqual ("mono 3", dtLoad.Rows[4][1, DataRowVersion.Current], "RowData4-C");
			Assert.AreEqual (DataRowState.Added, dtLoad.Rows[4].RowState, "RowState4");
			// asserting Added Row3
			Assert.AreEqual ("mono 4", dtLoad.Rows[3][1, DataRowVersion.Current], "RowData3-C");
			Assert.AreEqual (DataRowState.Added, dtLoad.Rows[3].RowState, "RowState3");
			// asserting Unpresent Row5
			// Notice row4 is used for added row of deleted row2 and so
			// unpresent row4 moves to row5
			Assert.AreEqual ("mono 5", dtLoad.Rows[5][1, DataRowVersion.Current], "RowData5-C");
			Assert.AreEqual (DataRowState.Added, dtLoad.Rows[5].RowState, "RowState5");
		}
开发者ID:symform,项目名称:mono,代码行数:41,代码来源:DataTableTest.cs


示例20: OnRowChanging

 private DataRowChangeEventArgs OnRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction) {
     if ((null != onRowChangingDelegate) || IsTypedDataTable) {
         if (null == args) {
             args = new DataRowChangeEventArgs(eRow, eAction);
         }
         OnRowChanging(args);
     }
     return args;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:DataTable.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# DataRowState类代码示例发布时间:2022-05-24
下一篇:
C# DataRow类代码示例发布时间: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