1

maybe title is not correctly describing what I want to achieve, so here is an example:

I have a code where I call this:

object.AddProvider<definition, implementation>()

method description is:

public void AddProvider<TDefinition, TImplementation>()
            where TDefinition: class
            where TImplementation : class, TDefinition, IDataProvider

I have configuration where I define 'definition' (interface) and 'implementation'

"Interface": "MyAssembly.Abstractions.IMongoDataProvider, MyAssembly.Abstractions" "Implementation": "MyAssembly.DataProviders.MongoDataProvider, MyAssembly.DataProviders"

Then I call this to get types from the configuration:

var definition = System.Type.GetType(@"{Interface}", true, true);
var implementation = System.Type.GetType(@"{Implementation}", true, true);

But I am not able to do this

object.AddProvider<definition, implementation>()

I don't know how to fulfill method's criteria (what to do between last two examples codes). Can anybody help me please?

Lukas Dvorak
  • 481
  • 4
  • 15

0 Answers0