mardi 16 mai 2017

C# pattern: requesting for implementation

What can be the way to some object requesting its implementation object?

Example:

public class Entity
{
    public static implicit operator DTO(Entity E)
    {
        var ValueObject = ORM.Get(KeyValue);
        ValueObjectProcessor = Container.Resolve(typeof(IProcessor<ValueObject>);
        var DTObject = ValueObjectProcessor.Process();
    }
}

public class SomeEntity
{
    public int MyProperty { get; set; }
    public int MyProperty { get; set; }
}

static void Main(string[] args)
{
    DTO newSome = new SomeEntity();
}


Is it right way, or Visitor pattern will be better?

Aucun commentaire:

Enregistrer un commentaire