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 C. Below you find are some recommendations how to cope with it. Best Regards, Mirko Matytschak
// Determine the max length of the field firstName of the class Employee using NDO.Mapping; ..... PersistenceManager pm = new PersistenceManager(); NDOMapping mapping = pm.NDOMapping; Class cl = mapping.FindClass(typeof(Employee)); int length = cl.FindField("firstName").ColumnLength; // If no length is determined in the mapping file, use the default for the database if (length == 0) length = cl.Provider.GetDefaultLength(typeof(string)); // Normally 255 // Optional you can iterate over all mapped fields: foreach(Field field in cl.Fields) { myTextBoxes[field.Name].MaxLength = field.ColumnLength; // assumes a field length for each field - // otherwise use GetDefaultLength like above }
// This is, how you get myTextBoxes: Hashtable myTextBoxes = new Hashtable(); foreach(Control c in myForm.Controls) { if (c is TextBox) myTextBoxes.Add(c.Name.Replace("text", string.Empty), c); }
// Here we assume, you have a naming convention // like firstName -> textFirstName // so take care of the upper/lower case first letter