码迷,mamicode.com
首页 > 其他好文 > 详细

[原] XAF How to bind a stored procedure to a ListView in XAF

时间:2014-11-29 10:10:58      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   color   os   sp   for   

First, I suggest that you review the following topic to learn how to show a custom set of objects in a ListView: How to: Display a List of Non-Persistent Objects.
To create non-persistent objects based on a stored procedure, use the Session.GetObjectsFromSproc method. Use the XPObjectSpace.Session property of the Object Space created for a new DetailView to get a Session instance. Here is an example based on the How to: Display a List of Non-Persistent Objects topic:

void showDuplicatesAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e) {
    IObjectSpace objectSpace = Application.CreateObjectSpace();
    StoredProcedureResults resultsHolder = new StoredProcedureResults(); // a custom non-persistent class with a Results collection
    ICollection<MyNonPersistentClass> results = ((XPObjectSpace)objectSpace).Session.GetObjectsFromSproc<MyNonPersistentClass>("mySproc");
    resultsHolder.Results.AddRange(results);
    e.View = Application.CreateDetailView(objectSpace, resultsHolder);
}

 

[原] XAF How to bind a stored procedure to a ListView in XAF

标签:style   blog   http   io   ar   color   os   sp   for   

原文地址:http://www.cnblogs.com/Tonyyang/p/4130035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!