コード例 #1
0
    public SingletonServiceRegistration <TService> RegisterSingleton <TService>(Func <TService> FactoryMethod) where TService : class
    {
        var service_interface = typeof(TService);

        lock (_SyncRoot)
        {
            var registration = new SingletonServiceRegistration <TService>(this, service_interface, FactoryMethod);
            _Services[service_interface] = registration;
            return(registration);
        }
    }
コード例 #2
0
    public SingletonServiceRegistration <TService> RegisterSingleton <TService>(TService ServiceInstance) where TService : class
    {
        var service_type = typeof(TService);

        lock (_SyncRoot)
        {
            var registration = new SingletonServiceRegistration <TService>(this, typeof(TService), ServiceInstance);
            _Services[service_type] = registration;
            return(registration);
        }
    }