SimpleIoc returns instances based on a key that you pass to it. If you call GetInstance() without a key, you will always get the default instance of your object. The instance is only created when you call GetInstance the first time (lazy creation). If you call GetInstance with a key, I look up if this named instance already exists in the registry. If it doesn't yet, I create it and then I return it. If there is an instance with that key already, I just return it.
In the alpha version (BL16 MIX edition), there is a bug that caused Register to create the instance too early, when a key was used. This bug is fixes in V4 beta1 which I will publish this week.
So as you see you will get the same instance from SimpleIoc if you always use the same key (or simply the default instance if you don't use a key at all).
Does it make sense?
Laurent
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…