我如何找到导致实体被修改的原因(在 XAF 中)?
How do I find what is causing an entity to be modified (in XAF)?
我需要找到导致实体被修改的代码。
在我的 .Net Core Winforms XAF EF 应用程序中
当我进入详细视图并单击关闭时
我收到一条消息要求我保存,即使我没有编辑任何东西。
我为我的 ViewController 添加了一个监听器,如下所示
private void ObjectSpace_ModifiedChanged(object sender, System.EventArgs e)
{
var os = sender as EFCoreObjectSpace;
foreach (var mo in os.ModifiedObjects)
{
Debug.Print(mo.ToString()); // break point
// debugger shows that mo is of type Castle.Proxies.JobExtProxy
}
}
在运行时,在断点处我看到以下调用堆栈。
JT.Module.Win.dll!JT.Module.Win.Features.Head.Controllers.JobHeadController.ObjectSpace_ModifiedChanged(object sender, System.EventArgs e) Line 51 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.BaseObjectSpace.OnModifiedChanged() Line 144 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.BaseObjectSpace.SetIsModified(bool isModified) Line 320 C#
DevExpress.ExpressApp.EFCore.v21.2.dll!DevExpress.ExpressApp.EFCore.EFCoreObjectSpace.OnEntityStateChanged(object sender, Microsoft.EntityFrameworkCore.ChangeTracking.EntityStateChangedEventArgs e) Unknown
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.OnStateChanged(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry internalEntityEntry, Microsoft.EntityFrameworkCore.EntityState oldState) Line 1310 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.FireStateChanged(Microsoft.EntityFrameworkCore.EntityState oldState) Line 348 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetPropertyModified(Microsoft.EntityFrameworkCore.Metadata.IProperty property, bool changeState, bool isModified, bool isConceptualNull, bool acceptChanges) Line 513 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.LocalDetectChanges.__SetPropertyModified|12_0(ref Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.<>c__DisplayClass12_0 value, ref Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.<>c__DisplayClass12_1 value, ref Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.<>c__DisplayClass12_2 value) Line 237 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.LocalDetectChanges(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) Line 203 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectChanges(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager stateManager) Line 154 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.DetectChanges() Line 227 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.TryDetectChanges() Line 189 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.HasChanges() Line 207 C#
DevExpress.ExpressApp.EFCore.v21.2.dll!DevExpress.ExpressApp.EFCore.EFCoreObjectSpace.IsModified.get() Unknown
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.SystemModule.ResetViewSettingsController.UpdateActionState() Line 91 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.SystemModule.ResetViewSettingsController.ResetViewSettingsController_CurrentObjectChanged(object sender, System.EventArgs e) Line 29 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.View.OnCurrentObjectChanged() Line 78 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ObjectView.OnCurrentObjectChanged() Line 151 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.DetailView.CurrentObject.set(object value) Line 289 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ListView.UpdateEditFrame(object currentObject) Line 189 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ListView.DoOnListEditorFocusedObjectChanged() Line 76 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ListView.listEditor_FocusedObjectChanged(object sender, System.EventArgs e) Line 88 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Editors.ListEditor.RaiseFocusedObjectChanged() Line 82 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Editors.ListEditor.UnlockSelectionEvents() Line 241 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.WinColumnsListEditor.gridDataSourceManager_DataSourceChanged(object sender, System.EventArgs e) Line 869 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.OnControlDataSourceChanged() Line 132 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.SetControlDataSource(object dataSource) Line 116 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.SetDataSource() Line 90 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.TrySetDataSource() Line 80 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.Control_HandleCreated(object sender, System.EventArgs e) Line 51 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.OnHandleCreated(System.EventArgs e) Line 7858 C#
DevExpress.XtraEditors.v21.2.dll!DevExpress.XtraEditors.Container.EditorContainer.OnHandleCreated(System.EventArgs e) Unknown
DevExpress.XtraGrid.v21.2.dll!DevExpress.XtraGrid.GridControl.OnHandleCreated(System.EventArgs e) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.WmCreate(ref System.Windows.Forms.Message m) Line 12125 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Line 13151 C#
DevExpress.XtraEditors.v21.2.dll!DevExpress.XtraEditors.Container.EditorContainer.WndProc(ref System.Windows.Forms.Message m) Unknown
DevExpress.XtraGrid.v21.2.dll!DevExpress.XtraGrid.GridControl.WndProc(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) Line 68 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 122 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 370 C#
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.Primitives.dll!Interop.User32.CreateWindowExW(Interop.User32.WS_EX dwExStyle, string lpClassName, string lpWindowName, Interop.User32.WS dwStyle, int X, int Y, int nWidth, int nHeight, System.IntPtr hWndParent, System.IntPtr hMenu, System.IntPtr hInst, object lpParam) Line 42 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams cp) Line 445 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateHandle() Line 4969 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5031 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5050 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5050 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5050 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5050 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl() Line 4993 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WmShowWindow(ref System.Windows.Forms.Message m) Line 12858 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Line 13305 C#
System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc(ref System.Windows.Forms.Message m) Line 1507 C#
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WndProc(ref System.Windows.Forms.Message m) Line 2093 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.WmShowWindow(ref System.Windows.Forms.Message m) Line 6443 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m) Line 6589 C#
DevExpress.Utils.v21.2.dll!DevExpress.XtraEditors.DForm.WndProc(ref System.Windows.Forms.Message m) Unknown
DevExpress.Utils.v21.2.dll!DevExpress.XtraEditors.XtraForm.WndProc(ref System.Windows.Forms.Message msg) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonForm.WndProc(ref System.Windows.Forms.Message msg) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) Line 68 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 122 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 370 C#
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.Primitives.dll!Interop.User32.CreateWindowExW(Interop.User32.WS_EX dwExStyle, string lpClassName, string lpWindowName, Interop.User32.WS dwStyle, int X, int Y, int nWidth, int nHeight, System.IntPtr hWndParent, System.IntPtr hMenu, System.IntPtr hInst, object lpParam) Line 42 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams cp) Line 445 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateHandle() Line 4969 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.CreateHandle() Line 3166 C#
DevExpress.Utils.v21.2.dll!DevExpress.XtraEditors.XtraForm.CreateHandle() Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonForm.CreateHandle() Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.Handle.get() Line 2422 C#
System.Windows.Forms.Primitives.dll!Interop.User32.ShowWindow(IHandle hWnd, Interop.User32.SW nCmdShow) Line 16 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.SetVisibleCore(bool value) Line 2316 C#
DevExpress.Utils.v21.2.dll!DevExpress.XtraEditors.XtraForm.SetVisibleCore(bool value) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonForm.SetVisibleCore(bool value) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.Show() Line 11320 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinWindow.Show() Line 480 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinShowViewStrategyBase.ShowWindow(DevExpress.ExpressApp.Win.WinWindow window) Line 281 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.MdiShowViewStrategy.ShowWindow(DevExpress.ExpressApp.Win.WinWindow window) Line 401 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.MdiShowViewStrategy.ShowViewInInspector(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 340 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinShowViewStrategyBase.ShowViewInNewWindow(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 395 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ShowViewStrategyBase.ShowViewCore(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 93 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.MdiShowViewStrategy.ShowViewCore(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 279 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ShowViewStrategyBase.ShowView(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 134 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Frame.ProcessActionCreatedView(DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) Line 199 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinWindow.ProcessActionCreatedView(DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) Line 403 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Frame.ShowViewAction_ProcessCreatedView(object sender, DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) Line 52 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Actions.ActionBase.OnProcessCreatedView(DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) Line 333 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Actions.ActionBase.ExecuteCore(System.Delegate handler, DevExpress.ExpressApp.Actions.ActionBaseEventArgs eventArgs) Line 194 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Actions.SimpleAction.DoExecute() Line 83 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Templates.ActionControls.Binding.SimpleActionBinding.DoExecute(System.EventArgs e) Line 33 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Templates.ActionControls.Binding.WinSimpleActionBinding.DoExecute(System.EventArgs e) Line 45 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Templates.ActionControls.Binding.SimpleActionBinding.ActionControl_Execute(object sender, System.EventArgs e) Line 30 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Templates.Bars.ActionControls.BarButtonItemSimpleActionControl.RaiseExecute(DevExpress.XtraBars.ItemClickEventArgs args) Line 30 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Templates.Bars.ActionControls.BarButtonItemSimpleActionControl.BarItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs args) Line 18 C#
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarItem.OnClick(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarBaseButtonItem.OnClick(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarButtonItem.OnClick(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarItemLink.OnLinkClick() Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarButtonItemLink.OnLinkClick() Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarItemLink.OnLinkAction(DevExpress.XtraBars.BarLinkAction action, object actionArgs) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(DevExpress.XtraBars.BarLinkAction action, object actionArgs) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarItemLink.OnLinkActionCore(DevExpress.XtraBars.BarLinkAction action, object actionArgs) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPressItem(DevExpress.Utils.DXMouseEventArgs e, DevExpress.XtraBars.Ribbon.ViewInfo.RibbonHitInfo hitInfo) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPress(DevExpress.Utils.DXMouseEventArgs e, DevExpress.XtraBars.Ribbon.ViewInfo.RibbonHitInfo hitInfo) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.RibbonHandler.OnUnPress(DevExpress.Utils.DXMouseEventArgs e, DevExpress.XtraBars.Ribbon.ViewInfo.RibbonHitInfo hitInfo) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnMouseUp(DevExpress.Utils.DXMouseEventArgs e) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.RibbonHandler.OnMouseUp(DevExpress.Utils.DXMouseEventArgs e) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonControl.OnMouseUp(System.Windows.Forms.MouseEventArgs e) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) Line 12439 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Line 13229 C#
DevExpress.Utils.v21.2.dll!DevExpress.Utils.Controls.ControlBase.BaseWndProc(ref System.Windows.Forms.Message m) Unknown
DevExpress.Utils.v21.2.dll!DevExpress.Utils.Controls.ControlBase.WndProc(ref System.Windows.Forms.Message m) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonControl.WndProc(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) Line 68 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 122 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 370 C#
[Native to Managed Transition]
[Managed to Native Transition]
DevExpress.Utils.v21.2.dll!DevExpress.Utils.Drawing.Helpers.NativeMethods.DefSubclassProc(System.IntPtr hWnd, System.IntPtr Msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
DevExpress.Utils.v21.2.dll!DevExpress.Utils.Drawing.Helpers.Win32SubclasserFactory.Win32Subclasser.SubClassProcInner(System.IntPtr hWnd, System.IntPtr Msg, System.IntPtr wParam, System.IntPtr lParam, System.IntPtr uIdSubclass, System.IntPtr dwRefData) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(System.UIntPtr dwComponentID, Interop.Mso.msoloop uReason, void* pvLoopData) Line 346 C#
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Interop.Mso.msoloop reason, System.Windows.Forms.ApplicationContext context) Line 1117 C#
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Interop.Mso.msoloop reason, System.Windows.Forms.ApplicationContext context) Line 981 C#
System.Windows.Forms.dll!System.Windows.Forms.Application.Run() Line 1181 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinApplication.DoApplicationRun() Line 530 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinApplication.Start() Line 899 C#
JT.Win.dll!JobTalk2.Win.Program.Main() Line 87 C#
我已经将框架更改为 net6.0-windows 所以我不确定这是否重要。
private void ObjectSpace_ModifiedChanged(object sender, System.EventArgs e)
{
var os = sender as EFCoreObjectSpace;
foreach (var entry in os.DbContext.ChangeTracker.Entries())
{
foreach (var p in entry.Properties)
{
if (p.IsModified)
{
Debug.Print($"{p.Metadata.Name} {p.OriginalValue} IS NOW {p.CurrentValue}");
}
}
}
}
我需要找到导致实体被修改的代码。 在我的 .Net Core Winforms XAF EF 应用程序中 当我进入详细视图并单击关闭时 我收到一条消息要求我保存,即使我没有编辑任何东西。
我为我的 ViewController 添加了一个监听器,如下所示
private void ObjectSpace_ModifiedChanged(object sender, System.EventArgs e)
{
var os = sender as EFCoreObjectSpace;
foreach (var mo in os.ModifiedObjects)
{
Debug.Print(mo.ToString()); // break point
// debugger shows that mo is of type Castle.Proxies.JobExtProxy
}
}
在运行时,在断点处我看到以下调用堆栈。
JT.Module.Win.dll!JT.Module.Win.Features.Head.Controllers.JobHeadController.ObjectSpace_ModifiedChanged(object sender, System.EventArgs e) Line 51 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.BaseObjectSpace.OnModifiedChanged() Line 144 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.BaseObjectSpace.SetIsModified(bool isModified) Line 320 C#
DevExpress.ExpressApp.EFCore.v21.2.dll!DevExpress.ExpressApp.EFCore.EFCoreObjectSpace.OnEntityStateChanged(object sender, Microsoft.EntityFrameworkCore.ChangeTracking.EntityStateChangedEventArgs e) Unknown
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.OnStateChanged(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry internalEntityEntry, Microsoft.EntityFrameworkCore.EntityState oldState) Line 1310 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.FireStateChanged(Microsoft.EntityFrameworkCore.EntityState oldState) Line 348 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetPropertyModified(Microsoft.EntityFrameworkCore.Metadata.IProperty property, bool changeState, bool isModified, bool isConceptualNull, bool acceptChanges) Line 513 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.LocalDetectChanges.__SetPropertyModified|12_0(ref Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.<>c__DisplayClass12_0 value, ref Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.<>c__DisplayClass12_1 value, ref Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.<>c__DisplayClass12_2 value) Line 237 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.LocalDetectChanges(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry entry) Line 203 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ChangeDetector.DetectChanges(Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IStateManager stateManager) Line 154 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.DetectChanges() Line 227 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.TryDetectChanges() Line 189 C#
Microsoft.EntityFrameworkCore.dll!Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.HasChanges() Line 207 C#
DevExpress.ExpressApp.EFCore.v21.2.dll!DevExpress.ExpressApp.EFCore.EFCoreObjectSpace.IsModified.get() Unknown
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.SystemModule.ResetViewSettingsController.UpdateActionState() Line 91 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.SystemModule.ResetViewSettingsController.ResetViewSettingsController_CurrentObjectChanged(object sender, System.EventArgs e) Line 29 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.View.OnCurrentObjectChanged() Line 78 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ObjectView.OnCurrentObjectChanged() Line 151 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.DetailView.CurrentObject.set(object value) Line 289 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ListView.UpdateEditFrame(object currentObject) Line 189 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ListView.DoOnListEditorFocusedObjectChanged() Line 76 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ListView.listEditor_FocusedObjectChanged(object sender, System.EventArgs e) Line 88 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Editors.ListEditor.RaiseFocusedObjectChanged() Line 82 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Editors.ListEditor.UnlockSelectionEvents() Line 241 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.WinColumnsListEditor.gridDataSourceManager_DataSourceChanged(object sender, System.EventArgs e) Line 869 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.OnControlDataSourceChanged() Line 132 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.SetControlDataSource(object dataSource) Line 116 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.SetDataSource() Line 90 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.TrySetDataSource() Line 80 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Editors.ControlDataSourceAdapter.Control_HandleCreated(object sender, System.EventArgs e) Line 51 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.OnHandleCreated(System.EventArgs e) Line 7858 C#
DevExpress.XtraEditors.v21.2.dll!DevExpress.XtraEditors.Container.EditorContainer.OnHandleCreated(System.EventArgs e) Unknown
DevExpress.XtraGrid.v21.2.dll!DevExpress.XtraGrid.GridControl.OnHandleCreated(System.EventArgs e) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.WmCreate(ref System.Windows.Forms.Message m) Line 12125 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Line 13151 C#
DevExpress.XtraEditors.v21.2.dll!DevExpress.XtraEditors.Container.EditorContainer.WndProc(ref System.Windows.Forms.Message m) Unknown
DevExpress.XtraGrid.v21.2.dll!DevExpress.XtraGrid.GridControl.WndProc(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) Line 68 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 122 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 370 C#
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.Primitives.dll!Interop.User32.CreateWindowExW(Interop.User32.WS_EX dwExStyle, string lpClassName, string lpWindowName, Interop.User32.WS dwStyle, int X, int Y, int nWidth, int nHeight, System.IntPtr hWndParent, System.IntPtr hMenu, System.IntPtr hInst, object lpParam) Line 42 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams cp) Line 445 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateHandle() Line 4969 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5031 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5050 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5050 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5050 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl(bool fIgnoreVisible) Line 5050 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateControl() Line 4993 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WmShowWindow(ref System.Windows.Forms.Message m) Line 12858 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Line 13305 C#
System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc(ref System.Windows.Forms.Message m) Line 1507 C#
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WndProc(ref System.Windows.Forms.Message m) Line 2093 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.WmShowWindow(ref System.Windows.Forms.Message m) Line 6443 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m) Line 6589 C#
DevExpress.Utils.v21.2.dll!DevExpress.XtraEditors.DForm.WndProc(ref System.Windows.Forms.Message m) Unknown
DevExpress.Utils.v21.2.dll!DevExpress.XtraEditors.XtraForm.WndProc(ref System.Windows.Forms.Message msg) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonForm.WndProc(ref System.Windows.Forms.Message msg) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) Line 68 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 122 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 370 C#
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.Primitives.dll!Interop.User32.CreateWindowExW(Interop.User32.WS_EX dwExStyle, string lpClassName, string lpWindowName, Interop.User32.WS dwStyle, int X, int Y, int nWidth, int nHeight, System.IntPtr hWndParent, System.IntPtr hMenu, System.IntPtr hInst, object lpParam) Line 42 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams cp) Line 445 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateHandle() Line 4969 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.CreateHandle() Line 3166 C#
DevExpress.Utils.v21.2.dll!DevExpress.XtraEditors.XtraForm.CreateHandle() Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonForm.CreateHandle() Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.Handle.get() Line 2422 C#
System.Windows.Forms.Primitives.dll!Interop.User32.ShowWindow(IHandle hWnd, Interop.User32.SW nCmdShow) Line 16 C#
System.Windows.Forms.dll!System.Windows.Forms.Form.SetVisibleCore(bool value) Line 2316 C#
DevExpress.Utils.v21.2.dll!DevExpress.XtraEditors.XtraForm.SetVisibleCore(bool value) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonForm.SetVisibleCore(bool value) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.Show() Line 11320 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinWindow.Show() Line 480 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinShowViewStrategyBase.ShowWindow(DevExpress.ExpressApp.Win.WinWindow window) Line 281 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.MdiShowViewStrategy.ShowWindow(DevExpress.ExpressApp.Win.WinWindow window) Line 401 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.MdiShowViewStrategy.ShowViewInInspector(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 340 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinShowViewStrategyBase.ShowViewInNewWindow(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 395 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ShowViewStrategyBase.ShowViewCore(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 93 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.MdiShowViewStrategy.ShowViewCore(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 279 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.ShowViewStrategyBase.ShowView(DevExpress.ExpressApp.ShowViewParameters parameters, DevExpress.ExpressApp.ShowViewSource showViewSource) Line 134 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Frame.ProcessActionCreatedView(DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) Line 199 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinWindow.ProcessActionCreatedView(DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) Line 403 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Frame.ShowViewAction_ProcessCreatedView(object sender, DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) Line 52 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Actions.ActionBase.OnProcessCreatedView(DevExpress.ExpressApp.Actions.ActionBaseEventArgs e) Line 333 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Actions.ActionBase.ExecuteCore(System.Delegate handler, DevExpress.ExpressApp.Actions.ActionBaseEventArgs eventArgs) Line 194 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Actions.SimpleAction.DoExecute() Line 83 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Templates.ActionControls.Binding.SimpleActionBinding.DoExecute(System.EventArgs e) Line 33 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Templates.ActionControls.Binding.WinSimpleActionBinding.DoExecute(System.EventArgs e) Line 45 C#
DevExpress.ExpressApp.v21.2.dll!DevExpress.ExpressApp.Templates.ActionControls.Binding.SimpleActionBinding.ActionControl_Execute(object sender, System.EventArgs e) Line 30 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Templates.Bars.ActionControls.BarButtonItemSimpleActionControl.RaiseExecute(DevExpress.XtraBars.ItemClickEventArgs args) Line 30 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.Templates.Bars.ActionControls.BarButtonItemSimpleActionControl.BarItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs args) Line 18 C#
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarItem.OnClick(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarBaseButtonItem.OnClick(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarButtonItem.OnClick(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarItemLink.OnLinkClick() Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarButtonItemLink.OnLinkClick() Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarItemLink.OnLinkAction(DevExpress.XtraBars.BarLinkAction action, object actionArgs) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(DevExpress.XtraBars.BarLinkAction action, object actionArgs) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.BarItemLink.OnLinkActionCore(DevExpress.XtraBars.BarLinkAction action, object actionArgs) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.ViewInfo.BarSelectionInfo.ClickLink(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(DevExpress.XtraBars.BarItemLink link) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPressItem(DevExpress.Utils.DXMouseEventArgs e, DevExpress.XtraBars.Ribbon.ViewInfo.RibbonHitInfo hitInfo) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnUnPress(DevExpress.Utils.DXMouseEventArgs e, DevExpress.XtraBars.Ribbon.ViewInfo.RibbonHitInfo hitInfo) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.RibbonHandler.OnUnPress(DevExpress.Utils.DXMouseEventArgs e, DevExpress.XtraBars.Ribbon.ViewInfo.RibbonHitInfo hitInfo) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.BaseRibbonHandler.OnMouseUp(DevExpress.Utils.DXMouseEventArgs e) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.Handler.RibbonHandler.OnMouseUp(DevExpress.Utils.DXMouseEventArgs e) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonControl.OnMouseUp(System.Windows.Forms.MouseEventArgs e) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) Line 12439 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Line 13229 C#
DevExpress.Utils.v21.2.dll!DevExpress.Utils.Controls.ControlBase.BaseWndProc(ref System.Windows.Forms.Message m) Unknown
DevExpress.Utils.v21.2.dll!DevExpress.Utils.Controls.ControlBase.WndProc(ref System.Windows.Forms.Message m) Unknown
DevExpress.XtraBars.v21.2.dll!DevExpress.XtraBars.Ribbon.RibbonControl.WndProc(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) Line 68 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 122 C#
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 370 C#
[Native to Managed Transition]
[Managed to Native Transition]
DevExpress.Utils.v21.2.dll!DevExpress.Utils.Drawing.Helpers.NativeMethods.DefSubclassProc(System.IntPtr hWnd, System.IntPtr Msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
DevExpress.Utils.v21.2.dll!DevExpress.Utils.Drawing.Helpers.Win32SubclasserFactory.Win32Subclasser.SubClassProcInner(System.IntPtr hWnd, System.IntPtr Msg, System.IntPtr wParam, System.IntPtr lParam, System.IntPtr uIdSubclass, System.IntPtr dwRefData) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(System.UIntPtr dwComponentID, Interop.Mso.msoloop uReason, void* pvLoopData) Line 346 C#
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Interop.Mso.msoloop reason, System.Windows.Forms.ApplicationContext context) Line 1117 C#
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Interop.Mso.msoloop reason, System.Windows.Forms.ApplicationContext context) Line 981 C#
System.Windows.Forms.dll!System.Windows.Forms.Application.Run() Line 1181 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinApplication.DoApplicationRun() Line 530 C#
DevExpress.ExpressApp.Win.v21.2.dll!DevExpress.ExpressApp.Win.WinApplication.Start() Line 899 C#
JT.Win.dll!JobTalk2.Win.Program.Main() Line 87 C#
我已经将框架更改为 net6.0-windows 所以我不确定这是否重要。
private void ObjectSpace_ModifiedChanged(object sender, System.EventArgs e)
{
var os = sender as EFCoreObjectSpace;
foreach (var entry in os.DbContext.ChangeTracker.Entries())
{
foreach (var p in entry.Properties)
{
if (p.IsModified)
{
Debug.Print($"{p.Metadata.Name} {p.OriginalValue} IS NOW {p.CurrentValue}");
}
}
}
}