我想检索数据表单的列表CPayment
,但是当我编写 linq 查询时,CPaymentModel
加载了TransactionHelper
类属性,但未加载类属性,无法查看
如何访问 Helper Class 属性或如何获取 Classes Helper 和 Non-Helper 属性的列表?如何解决这个问题呢..
我的模型类代码是
public class CPaymentModel<br>
{
public CPaymentModel()<br>
{
Transaction =new TransactionHelper();
}
//Local Class Properties
public UInt64 CardNo { get; set; }
public DateTime FileDate { get; set; }
//Helper Class
public TransactionHelper Transaction { get; set; }
}
public class TransactionHelper<br>
{
public int TransCode { get; set; }
public DateTime TransDate { get; set; }
}
控制器代码是:
public ActionResult GetPersons([DataSourceRequest] DataSourceRequest dsRequest)
{
var session = SessionManager.GetCurrentSession();<br>
var data2 = session.Query < CPayment > ().Select(row => new CPaymentModel()
{
CardNo = row.CardNo,<br>
FileDate = row.FileDate,<br>
Transaction =row.Transaction<br>
}).ToList < CPaymentModel > ();<br>
var list = data2.ToDataSourceResult(dsRequest);
return Json(list);
}
索引页面(KendoUI-grid)代码:
@(Html.Kendo().Grid < CPaymentModel > ()
.Name("PaymentInfo")
.DataSource(dataSource => dataSource
.Ajax()<br>
.Read(read => read.Action("GetPersons", "KendoDemo"))
)
)
我的输出是:[点击] http://i.stack.imgur.com/ZjKPU.png