Hi, I'd like to change the default value in application model - specifically a EditMask for all properties of type DateTime from value ‘D’ to value ‘G’ (show time part).
ModelDefault attribute over properties in business class is not for me solution, because I have done applications and properties of type DateTime Too many without this attribute.
Is there a way how to fix this?
Thank you.
Change the default value in application model
Answers approved by DevExpress Support
Hello Martin,
You can write domain logic for the IModelMember.EditMask property. Here is an example:
C#public sealed partial class MainDemoModule : ModuleBase {
...
public override void CustomizeLogics(CustomLogics customLogics) {
base.CustomizeLogics(customLogics);
customLogics.RegisterLogic(typeof(IModelMember), typeof(MyModelMemberLogic));
}
}
[DomainLogic(typeof(IModelMember))]
public class MyModelMemberLogic {
public static string Get_EditMask(IModelMember instance) {
if (instance.Type == typeof(Double)) {
return "c";
}
return String.Empty;
}
}
Please refer to the Extend and Customize the Application Model in Code topic for additional information.