This project has moved. For the latest updates, please go here.

Why are properties limited to non reference types?

Apr 29, 2014 at 2:18 PM
I'm attempting to store a Microsoft CRM Entity type in a table, but it contains a property that wasn't a value type, which threw an exception. The type is a EntityReference, which contains the Entity's name, the Entity's Id (GUID) and the Entity's Type Name (Account / Contact / Etc) What would be involved in being able to get NMemory to understand these types?
Coordinator
Apr 30, 2014 at 1:35 PM
Hello,

Thank you for the feedback. I restrict reference types because they are not guaranteed to be immutable. I may add an extension point that can enable arbitrary data types.
Apr 30, 2014 at 2:17 PM
Is this because this would break indexing logic? If I know I will never update those values, could I just edit the code and remove the constraint?
Coordinator
Apr 30, 2014 at 3:44 PM
Yes, indexes are only updated if you use the modification apis of the database.

You may edit it. As a workaround you can also create a struct type that references an EntityReference object and use that as the table entity property type.
Apr 30, 2014 at 3:51 PM
Except that the classes are auto-generated. I can't change their properties...

But I can remove that constraint, and as long as I'm not (yes this leaves things open to major issues if someone edits things and expects the indexes to work) updating those attributes, It should work just fine?
Coordinator
Apr 30, 2014 at 4:11 PM
Yes, it should work.
May 1, 2014 at 2:05 PM
I did get it to work. Also had to write my own Clone method, since it doesn't handle properties that are readonly.