0
我在牆上打了我的頭,試圖找出導致此錯誤的原因。Microsoft.Xrm.Sdk.Entity類型的變量SI在此範圍上被重新引用,但未定義。
當我運行我的項目時,當我使用Linq Query查詢Dynamics CRM數據庫時,會引發以下錯誤。
The variable SI of type Microsoft.Xrm.Sdk.Entity is refenced on this scope, but it is not defined"
重要的一點:我寫的行之前COMENT這是造成錯誤
任何幫助將不勝感激!
List<InnerAttributes> myQuery = (from PA in orgContext.CreateQuery("pluginassembly")
join PT in orgContext.CreateQuery("plugintype")
on (Guid)PA["pluginassemblyid"] equals (Guid)PT["pluginassemblyid"]
select new InnerAttributes
{
assembly = PA.Contains("name") ? PA["name"].ToString() : string.Empty,
left1 = (from S in orgContext.CreateQuery("sdkmessageprocessingstep")
where (Guid)S["plugintypeid"] == (Guid)PT["plugintypeid"]
select new Left1
{
message = S.Contains("sdkmessageid") ? S["sdkmessageid"].ToString() : string.Empty,
left2 = (from SI in orgContext.CreateQuery("sdkmessageprocessingstepimage")
//Here is the error, if I take that where clause off it runs well, however it doesn't give me expected return
where (Guid)S["sdkmessageprocessingstepid"] == (Guid)SI["sdkmessageprocessingstepid"]
select new Left2
{
imageAttributes = SI.Contains("attributes") ? SI["attributes"].ToString() : string.Empty,
}
).FirstOrDefault()
}).FirstOrDefault()
}
).ToList();
您是否嘗試過開關周圍的論點?在哪裏(Guid)SI [「sdkmessageprocessingstepid」] ==(Guid)S [「sdkmessageprocessingstepid」] – Bvrce
工作就像一個魅力。我不敢相信我還沒有嘗試過,非常感謝你! –
@Brrce爲您演示和工作的是CRM LINQ Provider的技術。 select中的實體必須始終位於「where」子句中比較的左側。 – Nicknow