Sunday, February 05, 2012
Support » Support Forum
Register Login
HomeWhat is NDO?- Executive Overview- NDO for DevelopersHow NDO Works- Persistent Classes- Mapping- Queries- Reverse Engineering- Inheritance, Polymorphism- Distributed ApplicationsLicensingSupport- Support Forum- FAQ- Solutions- Downloads- E-Mail Support- Tutorial VideosOnline ShopContact
Welcome to the NDO support forum!
Please register/login at the site if you want to post a thread. We sometimes copy support mails of common interest to the forum. They appear with anonymous sender. Please post your messages in English language if possible. You can do your posts also in German, we will translate your post and our answer so that all users of the forum can read your posts. The forum software requires that javascript is enabled. Please do not insert licence information or licence keys in forum posts. If you know a good answer to a post of another user, feel free to reply! The forum is monitored. We reserve the right to remove posts we consider not to be useful for other forum users.
Hi Stunney,
thanks for your interest in NDO. There is no way for NDO to know, how it should persist your int array in a relational database. That's the reason, why NDO ignores your array. There are two main options you can choose if you want to persist your array: the first is storing the values in a blob column of your table, the second is to store the values in an own table with a foreign key column that connects to the MyClass table.
To achieve the first scenario you define a persitent byte[] variable. Implement the IPersistenceNotifiable interface and use the OnLoading and OnSaving functions to convert the byte[] to the int[] and vice versa. Make sure to mark your object as dirty, if you change the content of the int[] array:((IPersistenceCapable)this).NDOMarkDirty();A similar approach would be to convert your int[] to a persistent string variable.
In the second scenario you need a special class holding the integer, and define a 1:n relation to that class:
[NDOPersistent]public class Stuff{ public Stuff(int val) { this.value = val; } int value;}
[NDOPersistent]public class MyClass {private int m_Value = 0;[NDORelation(RelationInfo.Composite)]List myStuff = new List();public void AddStuff(int val){ myStuff.Add(new Stuff(val));}... // Generate accessor functions and properties with the AddAccessor button.public int Value{ get{ return m_Value; } }}
I hope, that helps. If you have further questions, please ask.
Best Regards:Mirko