c# - Mapping a set of properties to another set where multiple source properties may be used in conversion rules? -


I have a set of properties defined, values ​​are all stored in the form of stars to return a new set of new properties Where the value of each new property can be in one of three ways.

  1. A direct copy of a specific source value.
  2. A default value.
  3. The result of some arguments applied to the values ​​of 1 or more source properties.

My approach to this problem was to create an IMFable interface

For each method, I set an implementation of this interface with the required logic in this method.

I have a factory method based on the name of an inappropriate asset:

  Private Imapable GetMapper (string localpropertyName) {char [] character = LocalpropertyNet. ToCharArray ( ); Chairs [0] = four. Touper (chairs [0]); String classname = new string (chars) + "mapping"; {Legislative assembly assembly = try assembly. GETExecutingAssembly (); Type classype = assembly GetType ("MyNamespace.Rules." + Classname, false, true); Implabel system. Activator Create instances (classotype); } Hold (System.Exception e) {// No mapper is present; New Default Mapping (LocalPropertyName); }}  

Is this the best way to solve this problem?

It seems like most elegenat, but I am concerned about the performance of dynamic class loading hits.

Is it slow? Give it a profile under the test and then worry whether it is slow or not.,


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -