public static void Test() { TinyIoc.Register <IServiceA1, ServiceA1>(true); TinyIoc.Register <IServiceB1, ServiceB1>(true); var serviceA = TinyIoc.ResolveByProp <IServiceA1>(); serviceA.Say("Hello World"); Console.Read(); }
public static void Test() { TinyIoc.Register <IServiceA2, ServiceA2>(true); TinyIoc.Register <IServiceB2, ServiceB2>(true); TinyIoc.Register <IServiceA3, ServiceA3>(true); TinyIoc.Register <IServiceB3, ServiceB3>(true); try { var serviceA = TinyIoc.ResolveByCtor <IServiceA2>(); serviceA.Say("Hello World"); } catch (Exception ex) { Console.WriteLine(ex.Message); } var serviceA3 = TinyIoc.ResolveByCtor <IServiceA3>(); serviceA3.Say("Hello World"); Console.Read(); }