C# - Naming a value combined "getter/setter" method (WebForms & Binding)
Looking for some help on some names for a project I'm currently working on. I don't have a compsci degree so I don't know what to call this.
I have a method called TryToGetSetValue(Direction direction, object value, object valueOnFail)
Then there would be a Direction enum
public enum Direction
{
ModelToForm,
FormToModel
}
Background This is a legacy ASP.NET application. The models, database, an开发者_如何学JAVAd mainframe are designed poorly. I can't put in MVP or MVC patterns yet (too much work). ASP.NET code is a ridiculous mess (partial pages, single-page design, 5x the normal amount of jQuery, everything is a jQuery UI dialog). I'm just trying to put in a bridge so then I can do more refactoring over the next year.
I have ~200 fields that need to be set on a GET and written back on a POST. I trying not to x2 these 200 fields and have 400 lines of code to support.
What would you call my method? enum? Is there so other form of binding that would be easy to use instead? I'm not a fan of the DetailsView or FormView built-ins of ASP.NET WebForms.
You probably want a Property
Just my $0.10 here, but how about:
public void AccessProperty(PropertyAccessType accessType, object value, object valueOnFail){...}
public enum PropertyAccessType
{
ModelToForm,
FormToModel
}
精彩评论