Yep, you're doing it wrong.. It will be re-generated at some point -- I've found it pretty inconsistent as to when that happens.
Those generated classes are either abstract or partial, so you should be able to just cut and paste your code into a separate file and be good to go. Reference here: https://documentation.devexpress.com/#Xaf/CustomDocument3258