Running v2.6, C#, Adapter pattern, compiling for .NET 3.5:
I've been trying to write an expression for use in a call to UpdateEntitiesDirectly. However I can only produce the expression I want by writing it as a DbFunctionCall, like so:
var adapter = new DAL.DatabaseSpecific.DataAccessAdapter();
var bucket = new RelationPredicateBucket();
bucket.Relations.Add(SpecialPriceEntity.Relations.ProductEntityUsingProductId);
var spUpdate = new SpecialPriceEntity();
spUpdate.Fields[(int) SpecialPriceFieldIndex.IsSentToBaan].ExpressionToApply =
new DbFunctionCall("CASE {0} WHEN 'TRUE' THEN NULL WHEN 'FALSE' THEN 'FALSE' END", new object[] {ProductFields.IsQonly});
adapter.UpdateEntitiesDirectly(spUpdate, bucket);
Is there any way I can write it using the LLBLGen Expression syntax, something like:
var adapter = new DAL.DatabaseSpecific.DataAccessAdapter();
var bucket = new RelationPredicateBucket();
bucket.Relations.Add(SpecialPriceEntity.Relations.ProductEntityUsingProductId);
var spUpdate = new SpecialPriceEntity();
spUpdate.Fields[(int) SpecialPriceFieldIndex.IsSentToBaan].ExpressionToApply =
(ProductFields.IsQonly == true ? DbNull.Value : false);
adapter.UpdateEntitiesDirectly(spUpdate, bucket);
As this is a lot more readable and easier to maintain.