views:

121

answers:

2

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, and 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.

+4  A: 

You probably want a Property

BlueRaja - Danny Pflughoeft
If I did properties this would have to be part of some Interface view through MVP. If not then how do my Properties on the Model object change textboxes, checkboxes, etc... on the WebForm?
tyndall
+1  A: 

Just my $0.10 here, but how about:

public void AccessProperty(PropertyAccessType accessType, object value, object valueOnFail){...}

public enum PropertyAccessType
{
    ModelToForm,
    FormToModel
}
code4life
I like this naming! +1
tyndall