vendredi 18 novembre 2016

Best approach for the intermediate layer & Conversion function

We have successfully completed developing new web application. It has Presentation layer, Business layer & Data Access layer.

For the new web application, we porting the existing Business layer & Data Access layer only presentation layer will be changed.

Though we are going to use the same business layer, there will be scenarios where there can be different model rather from existing model.

We are planning to built intermediate layer (new models) and Conversion function, to produce new model from the model delivered from existing business layer.

namespace Busniess
{
    public class Employee
    {
       public string FirstName {get; set;}
       public string LastName {get; set;}
    }
}

The new intermediate layer,

     namespace Intermediate
    {
        public class Employee
        {
           public string Address {get; set;}
           public string Zip {get; set;}
        }
    }

When I create instance of employee, Employee object should be capable of transforming into below scenarios

1. GetAll (all the properties FirstName, LastName, Address & Zip)
2. Selected (FirstName & Address) - if possible controlled through attribute decoration.

What is best way to create the intermediate layer & conversion function?

If the intermediate layer & conversion function is not a good candidate, what is the best approach?

Aucun commentaire:

Enregistrer un commentaire