Passing nullable types to DataPortal.Fetch

Passing nullable types to DataPortal.Fetch

Old forum URL: forums.lhotka.net/forums/t/12902.aspx


MikePolito posted on Friday, June 12, 2015

I am fairly new to CSLA4 and in general I have had no issues working with it until I tried to create Fetch method that passed a Nullable<Boolean> value. I can pass either 'true' or 'false' however if I pass in 'null', I get a DataPortal Exception.

An unhandled exception of type 'Csla.DataPortalException' occurred in Csla.dll

Additional information: DataPortal.Fetch failed (Invalid operation - fetch not allowed)

It seems reasonable to be able to do this.

Is this a bug or simply just not supported? - Why not?

ajj3085 replied on Friday, June 12, 2015

I think null means use parameter-less Fetch method, which you've not implemented.  Change your DPF to take a SingleCriteria<bool?> and call it passing an instance of that class.

MikePolito replied on Friday, June 12, 2015

Thanks!

Copyright (c) Marimer LLC