我正在研究 WCF、 Entity Framework 、自跟踪解决方案。
我对 ESQL 有疑问。
string cmd = "Select h.achAccId, p.patDOBirth, p.patGender from PatientEntities.AccBases as a, PatientEntities.AccHosps as h, PatientEntities.Patients as p Where h.achAccID = 57348 and p.patPatId = a.acbPatId and h.achAccId = a.acbAccId";
ObjectQuery<dbdatarecord>queryResult = null;
using (PatientEntities db = new PatientEntities()) PatientEntities is ObjectContext
{
`queryResult = db.CreateQuery<dbdatarecord>(cmd);`
}
if ((queryResult != null) && (queryResult.Count() > 0))
{
`...`
}
queryResult.Count()
导致错误:“‘achAccID’不是当前加载模式中‘PatientModel.AccHosp’类型的成员”
我在 PatientModel.edmx
下找到了文件,在 <EntityType Name="AccHosp">
下有<property Name="achAccID" Nullable="false" Type="int">
那么真正的问题是什么?
最佳答案
ESQL没有问题。数据上下文需要刷新。 IE。 db.Refresh(RefreshMode.StoreWins, db.AccHosps);
关于c# - ESQL 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15284093/