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 tried to introduce a custom datatype through your type mapping feature: http://www.mindscapehq.com/blog/index.php/2010/08/22/ninja-data-type-mappings-in-lightspeed/ I followed the above description. The database shows the right column type (string), the entity has the correct type (string[]). When I set some values and save them to the db the custom columns are null. Therefore it is not surprising that entities from the db also contain null values. I added breakpoints to my code and my converter is never used or even created. I also checked the LS-generated code: [Column(ConverterType=typeof(MyNamespace.MyConverter))] I am using LS 3.11 nightly 20110110. Am I missing something? Regards, Dennis |
|
|
LightSpeed by defaults excludes fields of 'unknown' reference types from the load/save cycle (on the grounds that databases never return references). Because String[] is a reference type, your _r field is therefore being ignored. It seems to me that LightSpeed to take ColumnAttribute as a clue that the field is mapped to the database and should therefore not be excluded! So I will try to get this fixed for you. In the meantime, the fix is to add the ValueFieldAttribute to the _r field: [Column(...)] The designer should do this automatically for you if you set IsStandardDataType=false on the user-defined type, though the downside of this is that you will need to enter the database type name if you want designer sync, which could impact portability across different database engines. |
|