This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I'm trying to implement mapping of CHAR(1) column to boolean. I found http://www.mindscape.co.nz/blog/index.php/2010/08/22/ninja-data-type-mappings-in-lightspeed/ artcle very helpful. But... I have a problem using such fields in LINQ. For purpose of problem demonstration to avoid any possible problem with Nulls and type conversions I've made YesNoConverter always returning "N" and "false" - public class YesNoConverter : Mindscape.LightSpeed.IFieldConverter { Now I have a class Aircraft with Locked attribute of boolean type
My first query works fine - var q1 = from x in model.Aircrafts select x;
var q2 = from x in model.Aircrafts select x.Locked; BTW, I've installed LightSpeed 3.11. , but Mindscape.LightSpeed and Mindscape.LightSpeed.Linq assemblies show version 3.1.1891.14711. Is it ok? Thank you, |
|
|
Thanks for drawing our attention to this. We had a bug where field converters were only being used in entity materialisation, not in LINQ projections (which bypass the whole entity subsystem). This will be fixed in the next nightly build, which should be available around 1200 UTC. Yes, 3.1.1891.14711 is correct for LightSpeed 3.11. We didn't bump the minor version for the .01 release, but build number 14711 is right. |
|
|
Ivan, Thank you for fix. Now "select x.Locked" works fine. But using of boolean atribute in WHERE clause generates wrong query - var q2 = from x in session.Aircrafts BEGIN It doesn use IFieldConverter.ConvertToDatabase at all and as result instead of mapped value "N" it uses numeric literal "0". Alexander
|
|
|
Sorry about that. It will be fixed in the next nightly build. Note that some queries are not allowed against columns with field converters. For example, a Between query cannot be performed against a converted column because the ordering of the database type may be different from the ordering of the converted values. For similar reasons, I have not addressed field converter support in OrderBy clauses. Finally, functions and traversals may not work with converted columns. Please let us know if this becomes a limitation for you, and of course do let us know if you run into any more issues with this. Thank you for your feedback and for reporting these issues! |
|
|
Ivan, Thank you for fast fix. Works nice! Alex |
|