I am going to use StructureMap as a way to do DI. I'll use xml as my DI configuration. I have two questions.
The first one is how to use a customaized xml file name instead of StructureMap.Config? For example, in my console application, if I want to use myDIStructure.config file, what class and method should I use in the main():
private static void main(string[] args) {
//? OjbectFactory.UserConfigurationFile = "myDIStructure.config";
Program program = ObjectFactory.GetInstance<Program>();
...
}
The second question is how I define generic interface with a class type in my configuration file. For example, I have the following interface and class:
public interface ProcessData<T> {
void ReadData(T data);
void ProcessData(T data);
void SaveData(T data);
}
...
public class Data1 {....} // this class will be used for ProcessData<T>
....
public class MyProcessData : ProcessData<Data1> {....} // implementation class
Then in my console application, I would like to use PlugInFamily for ProcessData interface type, and Plugin for MyProcessData. Not sure if this is possible in StructionMap and how?