Exemplo n.º 1
0
        public static IServiceCollection AddLiveStateUpdater <TLocal, TState, TLiveUpdater>(
            this IServiceCollection services)
            where TLiveUpdater : class, ILiveStateUpdater <TLocal, TState>
            where TState : class
        {
            var serviceAttributes = ServiceAttributeBase.GetAll(typeof(TLiveUpdater), a => !(a is LiveStateUpdaterAttribute));

            return(services.AddService <TLiveUpdater>(serviceAttributes, new ServiceAttribute(typeof(ILiveStateUpdater <TLocal, TState>))));
        }
Exemplo n.º 2
0
        public static IServiceCollection AddLiveStateUpdater(
            this IServiceCollection services,
            Type localType, Type stateType, Type updaterType)
        {
            var iUpdaterType      = typeof(ILiveStateUpdater <,>).MakeGenericType(localType, stateType);
            var serviceAttributes = ServiceAttributeBase.GetAll(updaterType, a => !(a is LiveStateUpdaterAttribute));

            return(services.AddService(updaterType, serviceAttributes, new ServiceAttribute(iUpdaterType)));
        }