Tuesday, November 8, 2011

In case you need one more reason not to use Nullable Booleans

...I would offer that they do not jive well with LinqSpecs as:

var isRetiredSpec = new AdHocSpecification<Program>(p => p.IsRetired == false);

 
 

...behaves much better when IsRetired is a Boolean and not a Nullable Boolean. In the later case, this InvalidPathException occurs:

Message: Invalid path: 'p.IsRetired' [.Select(.Where(NHibernate.Linq.NhQueryable`1[MyApp.Core.Entities.Program], Quote((ssd, ) => (AndAlso(BaseEntity`1.op_Inequality(ssd, NULL), (p, ) => (Equal(p.IsRetired, p2))ssd))), ), Quote((p, ) => (p.Id)), )]

No comments:

Post a Comment