Esempio n. 1
0
 public ActorServiceFabricHostedService(
     IServiceProvider serviceProvider,
     IActorServiceCreatorFactory actorServiceFactory,
     ActorServiceFabricRegistrationOptions registrationOptions,
     ILogger <ActorServiceFabricHostedService <TActor> > logger)
 {
     _actorServiceFactory = actorServiceFactory;
     _registrationOptions = registrationOptions;
     _logger = logger;
     _addServiceContextToLogging = serviceProvider.GetService <Action <ServiceContext> >();
 }
Esempio n. 2
0
        public static IHostBuilder UseServiceFabricActorServiceFactory <TActor>(this IHostBuilder hostBuilder, ActorServiceFabricRegistrationOptions options = null)
            where TActor : ActorBase
        {
            options = options ?? new ActorServiceFabricRegistrationOptions();

            return(hostBuilder.ConfigureServices(services =>
            {
                services.AddSingleton(options);
                services.AddSingleton <Func <StatefulServiceContext, ActorTypeInformation, ActorService> >((context, actorType) => new ActorService(context, actorType));
                services.AddSingleton <IActorServiceCreatorFactory, ActorServiceFactory>();
                services.AddHostedService <ActorServiceFabricHostedService <TActor> >();
            }));
        }
Esempio n. 3
0
        public static IHostBuilder UseServiceFabricActorServiceFactory <TActor, TActorServiceFactory>(this IHostBuilder hostBuilder, ActorServiceFabricRegistrationOptions options = null)
            where TActor : ActorBase
            where TActorServiceFactory : class, IActorServiceCreatorFactory
        {
            options = options ?? new ActorServiceFabricRegistrationOptions();

            return(hostBuilder.ConfigureServices(services =>
            {
                services.AddSingleton(options);
                services.AddSingleton <IActorServiceCreatorFactory, TActorServiceFactory>();
                services.AddHostedService <ActorServiceFabricHostedService <TActor> >();
            }));
        }