我的商店程序将返回多个结果集。如何使用EF db first方法将它们绑定到我的模型?
我的模特
public class SearchCriteriaResults
{
[Key]
public string RecordID { get; set; }
public int? SNO { get; set; }
public int? CountyCode { get; set; }
public string CountyName { get; set; }
}
public class Locations
{
//Locations
public byte section { get; set; }
public byte township { get; set; }
public byte range { get; set; }
}
每个RecordID将在地点中包含多个记录。
我的SP代码
public List<SearchCriteriaResults> GetRecordDetailsbyID(string RecID)
{
List<SearchCriteriaResults> strResult = new List<SearchCriteriaResults>();
try
{
strResult = objVCHEntities.ExecuteStoreQuery<SearchCriteriaResults> ("[GetRecordDetailsbyID] @RecID={0}", RecID).ToList();
}
catch (Exception ex)
{
throw ex;
}
return strResult;
}
我总是只从SP获得一条绑定到SearchCriteriaResults
的记录。
我的SP查询
select rd.RecordID,bookType,grantee,grantor from Record rd where rd.RecordID = '12345'
select section from Location where RecordID = '12345'
在上面的查询中我也可以使用join,但是如何绑定到我的Model类?