tags:

views:

80

answers:

0

I am using the MS unity framework to create a simple object factory. I have created the .config file to map interface ICAR to object CAR. It works great using the default constructor. Now, when I want to add a second constructor that takes in an int (id), I am having troubles. I have seen examples where you can pass in this param to the constructor via the config file, but the ids need to be dynamic. I want the end user to get an CAR object like this "ICar c = Factory.GetCar(1);". I could probably set the ID as a property, but I would like to do this in the constructor. Also, in my factory, I only want to make reference to ICAR, not the CAR object.

Any ideas?