DbFunctionCall Combine with Expression

Posts   
 
    
JMuller
User
Posts: 19
Joined: 09-Mar-2009
# Posted on: 05-Aug-2009 12:31:16   

Hi,

I Would like to combine a DbFunctionCall with a Expression.

Desired query would look like:

((COALESCE(PriceIncl1, PriceIncl2, PriceIncl3)) / (1 + (19 / 100))) as PriceExcl

I thread http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=8054 i read its possible to combine multple DbFunctionCall like:



new DbFunctionCall("ROUND", new object[] { new DbFunctionCall("ROUND", new object[] { (OrderDetailsFields.UnitPrice * OrderDetailsFields.Quantity), -1 }), -1})


But i can't figure out how to do this with a expression.

Thnx

JMuller
User
Posts: 19
Joined: 09-Mar-2009
# Posted on: 05-Aug-2009 13:18:56   

Solved the problem:



.SetExpression(
  new DbFunctionCall("CAST( ROUND ( {0} * (1 + ( 19 / 100)) , 0) as int)", new object[] { 
    new DbFunctionCall("COALESCE", PriceInclParams.ToArray()) }));


JM

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 05-Aug-2009 13:32:38   

simple_smile