C# MissingMemberException未经处理EntitySet X对象没有属性Y
更新 我想问题可能是我的关联设置错误…有些表是一对一的,我把它们作为一对多的 我正在使用IronPythonC和linq2sql编写一个报告程序。报告python文件中出现以下错误代码:C# MissingMemberException未经处理EntitySet X对象没有属性Y,c#,python,linq,ironpython,C#,Python,Linq,Ironpython,更新 我想问题可能是我的关联设置错误…有些表是一对一的,我把它们作为一对多的 我正在使用IronPythonC和linq2sql编写一个报告程序。报告python文件中出现以下错误代码: #Evaluation Comment Workflow Records doc.EvaluationCommentworkflowRecords = []; if (doc.crRecord.V_SOS_CR_EVAL and doc.crRecord.V_SOS_CR_EVAL.V_SOS_WFDSTs.C
#Evaluation Comment Workflow Records
doc.EvaluationCommentworkflowRecords = [];
if (doc.crRecord.V_SOS_CR_EVAL and doc.crRecord.V_SOS_CR_EVAL.V_SOS_WFDSTs.Count > 0):
doc.EvaluationCommentworkflowRecords = doc.crRecord.V_SOS_CR_EVAL.V_SOS_WFDSTs.Where(lambda p: p.DOCTYPE and
p.DOCTYPE == (doc.evalDocType) and
p.ST_DATE).OrderBy(lambda p: p.ST_DATE).ToList()
#End Evaluation Comment Workflow Records
return doc
我收到的错误消息说EntitySet[V_SOS_CR_EVAL]对象没有属性V_SOS_WFDSTs
但我在linq2sql中使用关联和dataprovider类建立连接:
//evaluation and subs
loadOptions.LoadWith<V_SOS_CR>(p => p.V_SOS_CR_EVAL);
loadOptions.LoadWith<V_SOS_CR_EVAL>(p => p.SOS_ATTs);
loadOptions.LoadWith<V_SOS_CR_EVAL>(p => p.V_SOS_WFDSTs);
下面是DBML designer.cs文件:
public V_SOS_CR_EVAL()
{
this._SOS_ATTs = new EntitySet<SOS_ATT>(new Action<SOS_ATT>(this.attach_SOS_ATTs), new Action<SOS_ATT>(this.detach_SOS_ATTs));
this._V_SOS_WFDSTs = new EntitySet<V_SOS_WFDST>(new Action<V_SOS_WFDST>(this.attach_V_SOS_WFDSTs), new Action<V_SOS_WFDST>(this.detach_V_SOS_WFDSTs));
this._V_SOS_CR = default(EntityRef<V_SOS_CR>);
OnCreated();
}
然后在代码的更深处:
public V_SOS_WFDST()
{
this._V_SOS_CR = default(EntityRef<V_SOS_CR>);
this._V_SOS_CR_MRULE = default(EntityRef<V_SOS_CR_MRULE>);
this._V_SOS_CR_OPERABILITY = default(EntityRef<V_SOS_CR_OPERABILITY>);
this._V_SOS_CR_REPORTABILITY = default(EntityRef<V_SOS_CR_REPORTABILITY>);
this._V_SOS_CR_EVAL = default(EntityRef<V_SOS_CR_EVAL>);
this._V_SOS_CR_ACTION = default(EntityRef<V_SOS_CR_ACTION>);
OnCreated();
}
如果有人能想到如何修复这个错误,请让我知道
谢谢,
尼克问题在于与表格的关联。当他们本应该是一对一的时候,我有很多人被设定为一对多