In my application, I add PredicateExpressions to the ASP.NET session state. ASP.NET implements this by using binary serialization on the PredicateExpression.
Up though LLBLGen 5.4, this worked fine. However, after updating to version 5.5, it's failing with an exception like this:
System.Web.HttpException (0x80004005): Couldn't update session state for SessionID: au41gjeocfqsoibc0mtx0q5n ---> System.Web.HttpException (0x80004005): Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode. ---> System.Runtime.Serialization.SerializationException: Type 'SD.LLBLGen.Pro.ORMSupportClasses.UnionList`1[[SD.LLBLGen.Pro.ORMSupportClasses.DerivedTableDefinition, SD.LLBLGen.Pro.ORMSupportClasses, Version=5.5.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27]]' in Assembly 'SD.LLBLGen.Pro.ORMSupportClasses, Version=5.5.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27' is not marked as serializable.
From the names of the classes involved (UnionList<T>), I assume that this is a result of adding support for SQL Unions in 5.5.
I grabbed the latest LLBLGen source code, added [Serializable] to UnionList<T> and UnionListElement<T>, and linked that build to my application, and my application now works correctly.
Not every predicate seems to include a UnionList. In my case, the predicates that did include it were ones like this:
var saleTotalQ =
Functions.Coalesce(
qf.Create()
.Select(SaleElementFields.Total)
.Where(SaleElementFields.SupporterId.Equal(SupporterWithRolesFields.SupporterId)
.And(SaleElementFields.ProjectId.Equal(ProjectId.Value))
)
.Sum(),
0);
var paymentTotalQ = Functions.Coalesce(
qf.Create()
.Select(PaymentFields.Amount)
.Where(
PaymentFields.SupporterId.Equal(SupporterWithRolesFields.SupporterId)
.And(PaymentFields.ProjectId.Equal(SupporterWithRolesFields.ProjectId))
)
.Sum(),
0);
var predicatetoSerialize = saleTotalQ.GreaterThan(paymentTotalQ);
Would you be willing to add [Serializable] to UnionList<T> and UnionListElement<T> to enable my application to continue to work?
Thanks.