Пример #1
0
        private void RegisterNormal(ContainerBuilder buildr, InstanceDef d)
        {
            if (d.Interface2 != null)
                buildr.RegisterType(d.Implementation)
                      .As(d.Interface1)
                      .As(d.Interface2);

            else if (d.Interface1 != null)
                buildr.RegisterType(d.Implementation)
                      .As(d.Interface1);
            else
                buildr.RegisterType(d.Implementation);
        }
Пример #2
0
        private void RegisterSingleton(ContainerBuilder buildr, InstanceDef d)
        {
            if (d.Interface2 != null)
                buildr.RegisterType(d.Implementation)
                      .As(d.Interface1)
                      .As(d.Interface2)
                      .SingleInstance();

            else if (d.Interface1 != null)
                buildr.RegisterType(d.Implementation)
                      .As(d.Interface1)
                      .SingleInstance();

            else if (d.Interface1 == null)
                buildr.RegisterType(d.Implementation)
                      .SingleInstance();
        }