Asked by:
linq excption

Question
-
i have a problem after not receiving any results from linq query
i saw this post regarding similar problem http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/d3968991-18f7-4981-9350-47b9fecf53ab
but it give solution only for the first record (using firstordefualt)
the function any is not implementeed
Wednesday, January 18, 2012 12:17 PM
All replies
-
Hi,
pls post your linq query.
Thomas T(MCBMSS) If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".Thursday, January 19, 2012 5:47 AM -
var lSalesOrderDetail = from aa in
ctx.Entities.SalesOrderDetailSet
join bb in ctx.Entities.ProductSet on aa.ProductId.Id equals
bb.ProductId.Value
join cc in ctx.Entities.SalesOrderSet on aa.SalesOrderId.Id equals
cc.SalesOrderId
where
cc.SalesOrderId == ctx.PluginExecutionContext.PrimaryEntityId
select new
{ ProductName = aa.ProductId.Name , Quantity = aa.Quantity , PrimaryContactName = cc.CustomerId.Name
,RequestDeliveryBy = aa.RequestDeliveryBy , ProductNumber = bb.ProductNumber , OrderNumber = cc.OrderNumber
,OrderRequestDeliveryBy = cc.RequestDeliveryBy};
Monday, January 23, 2012 10:42 AM -
Hi, sorry for the delay in replying. i have tested your linq query and it does not have issue with the syntax, and it is worked for me. hopefully you have fixed the issue as well.
if not, I can see that you are executing this in your plugin, please give more detail about plugin, also have checked whether it is throwing any exception. also check the ctx.PluginExecutionContext.PrimaryEntityId is giving the actual value as you expected. I have tried your query with bit of change to work in my test environment and it worked for me.
var lSalesOrderDetail = from aa in _orgContext.CreateQuery<SalesOrderDetail>() join bb in _orgContext.CreateQuery<Product>() on aa.ProductId.Id equals bb.ProductId.Value join cc in _orgContext.CreateQuery<SalesOrder>() on aa.SalesOrderId.Id equals cc.SalesOrderId where cc.SalesOrderId != Guid.Empty select new { ProductName = aa.ProductId.Name, Quantity = aa.Quantity, PrimaryContactName = cc.CustomerId.Name, RequestDeliveryBy = aa.RequestDeliveryBy, ProductNumber = bb.ProductNumber, OrderNumber = cc.OrderNumber, OrderRequestDeliveryBy = cc.RequestDeliveryBy }; foreach (var q in lSalesOrderDetail) { Console.WriteLine(q.OrderNumber); }
Thomas T(MCBMSS) If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".Wednesday, January 25, 2012 9:25 AM