XAF之 未解决——无法显示包含nonpersistent对象的ListView

来源:互联网 发布:八陆融通网络借贷 编辑:程序博客网 时间:2024/05/16 06:23

        当尝试在ListView中显示NonPersistent Obejct时,会报告objectKeyAsString参数为null,显示一个红色大叉。


查看输出如下:

15.05.12 10:50:47.201 ->GetPopupWindowParams
15.05.12 10:50:47.202 Type: DevExpress.ExpressApp.Actions.PopupWindowShowAction
15.05.12 10:50:47.203 ID: b97c96de-e2e9-4132-a5e7-46d384838773
15.05.12 10:50:47.204 Category: Unspecified
15.05.12 10:50:47.205 ContextName: User
15.05.12 10:50:47.206 IsRoot: True
15.05.12 10:50:47.207 Selection.Count: 1
15.05.12 10:50:47.208 CurrentObject: DevExpress.ExpressApp.Security.SecuritySimpleUser(544f6a52-9f48-48e2-bdf0-0b5b6025c63d)
15.05.12 10:50:47.274 --------------------------------------------------------------------------------
15.05.12 10:50:47.275 <- GetPopupWindowParams
15.05.12 10:50:48.389 ================================================================================
The error occurred:


Type:       ArgumentNullException
Message:    值不能为 null。
参数名: objectKeyAsString
Data:       0 entries
Stack trace:



   在 DevExpress.ExpressApp.ObjectHandleHelper.CreateObjectHandle(ITypesInfo typesInfo, Type objectType, String objectKeyAsString)
   在 DevExpress.ExpressApp.ObjectSpace.GetObjectHandle(Object obj)
   在 DevExpress.ExpressApp.Security.MemberOperationPermissionRequest..ctor(Object targetObject, String memberName, String operation)
   在 DevExpress.ExpressApp.DataManipulationRight.HasPermissionTo(Type objectType, String memberName, Object targetObject, CollectionSourceBase collectionSource, String operation)
   在 DevExpress.ExpressApp.DataManipulationRight.CanRead(Type objectType, String propertyName, Object targetObject, CollectionSourceBase collectionSource)
   在 DevExpress.ExpressApp.Win.Editors.GridListEditor.gridView_CustomDrawCell(Object sender, RowCellCustomDrawEventArgs e)
   在 DevExpress.XtraGrid.Views.Grid.GridView.RaiseCustomDrawCell(RowCellCustomDrawEventArgs e)
   在 DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRowCell(GridViewDrawArgs e, GridCellInfo cell)
   在 DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRegularRowCell(GridViewDrawArgs e, GridCellInfo ci)
   在 DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRegularRow(GridViewDrawArgs e, GridDataRowInfo ri)
   在 DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRow(GridViewDrawArgs e, GridRowInfo ri)
   在 DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawRows(GridViewDrawArgs e)
   在 DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.DrawContents(GridViewDrawArgs e)
   在 DevExpress.XtraGrid.Views.Grid.Drawing.GridPainter.Draw(ViewDrawArgs ee)
   在 DevExpress.XtraGrid.Views.Base.BaseView.Draw(GraphicsCache e)
   在 DevExpress.XtraGrid.GridControl.OnPaint(PaintEventArgs e)
   在 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   在 System.Windows.Forms.Control.WmPaint(Message& m)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 DevExpress.XtraEditors.Container.EditorContainer.WndProc(Message& m)
   在 DevExpress.XtraGrid.GridControl.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException is null

        从上面的输出可以看到,是XAF的安全机制导致的结果,所以,我尝试,将工程的安全策略取消,果然不再报错。但一个Bussiness Software不可能没有安全机制,若为了使用Nonpersistent Object而去掉自带的安全机制无疑是挖肉补疮。

  这是官网上给出的解释,说明是安全机制的缘故,也印证了我的猜想。目前,只好不在View中显示NonPersistent Object

后注:已解决,见我下一篇博文。