Hello,
I've an issue regarding LINQ and an IEnumerable collection with BusinessBase objects containing SmartDate properties. Using the latest CSLA.NET Release.
Here is what I try (hopefully enough code):
Part of what you're running into is that a SmartDate is declared as a struct. Therefore, by definition it can't be NULL.
More specific to your error, the SmartDate struct has several operator overloads, but none of them take an object as the second argument. Since a NULL value doesn't convert to anything other than an object type without a specific cast, .NET can't find an operator overload with the correct signature.
My best recommendation for this error is to remove the NULL check from your query filter, as it shouldn't be necessary.
HTH
- Scott
My general recommendation is to NOT expose the SmartDate struct as a property.
Use snippet cslapropdt to define the property.
public static readonly PropertyInfo<SmartDate> StartDateProperty = RegisterProperty<SmartDate>(c => c.StartDate); public string StartDate { get { return GetPropertyConvert<SmartDate, string>(StartDateProperty); } set { SetPropertyConvert<SmartDate, string>(StartDateProperty, value); } }
If necessary add a when you also need the DateTime value
[Browsable(false)] public DateTime StartDateAsDateTime { get { return GetPropertyConvert<SmartDate, DateTime>(StartDateProperty); } set { SetPropertyConvert<SmartDate, DateTime>(StartDateProperty, value); } }
Copyright (c) Marimer LLC