如何使用FetchEntityCollection而不是FetchEntity
本文关键字:FetchEntity 何使用 FetchEntityCollection | 更新日期: 2023-09-27 18:10:03
我试图通过LLBL适配器填充一个剑道网格数据。当我传入一个PK时,我能够使用一个断点看到一个结果,但是我需要返回整个结果集合。需要返回的字段有:BundleId、CarrierId、Date、IsSent
谢谢控制器
public ActionResult BundleStatus()
{
return View();
}
//[HttpPost]
//public ActionResult BundleStatusRead([DataSourceRequest] DataSourceRequest request)
//{
// DataAccessAdapter adapter = new DataAccessAdapter();
// CarrierBundleEntity bundle = new CarrierBundleEntity(6);
// adapter.FetchEntity(bundle);
// var results = bundle;
// return View(results);
//}
public ActionResult BundleStatusRead([DataSourceRequest] DataSourceRequest request)
{
DataAccessAdapter adapter = new DataAccessAdapter();
CarrierBundleEntity bundle = new CarrierBundleEntity();
var Results = adapter.FetchEntityCollection(bundle);
return Json(Results.ToDataSourceResult(request));
}
}
错误消息The best overloaded method match for 'SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(SD.LLBLGen.Pro.ORMSupportClasses.QueryParameters)' has some invalid arguments
我想到了如何一次恢复所有数据的方法。
public ActionResult BundleStatusRead()
{
DataAccessAdapter adapter = new DataAccessAdapter();
EntityCollection allBundles = new EntityCollection(new CarrierBundleEntityFactory());
adapter.FetchEntityCollection(allBundles, null);
var results = allBundles;
return View(results); }