0

I want to insert an object into my repository but not explicitly like that at coding-time:

_repository<Car>().Add(carObject);

Instead of this, I want to push the object to the corresponding class name at runtime.

I can create the object at runtime but I can't set the class name in __repository<???>().Add(object) here.

In this exemple, if I've a string name Car (it might be other class name like Person), then how can I do the same thing using the given code written only once to be applied to any type?

0 Answers0