Example #1
0
        public void Register(Type component, Type service, ComponentAttribute attr = null)
        {
            if (attr == null)
            {
                attr = component.GetComponentAttr();
            }

            switch (attr.LiftTime)
            {
            case LifetimeType.Scopped:
                _services.AddScoped(service, component);
                break;

            case LifetimeType.Singleton:
                _services.AddSingleton(service, component);
                break;

            default:
                _services.AddTransient(service, component);
                break;
            }
        }