コード例 #1
0
        public void Build(IFunctionHostBuilder builder)
        {
            builder
            .SetupApplication((serviceCollection, commandRegistry, c) =>
            {
                IConfiguration config = (IConfiguration)c;

                serviceCollection.ConfigureDatabase <RecommendationDbContext>(config);

                serviceCollection.RegisterCoreDependencies();

                serviceCollection.RegisterApplicationDependencies();

                serviceCollection.RegisterAzureServiceBus(config);

                commandRegistry.Discover <WorkerConfiguration>();
            })
            .Authorization(authorization => authorization
                           .AuthorizationDefault(AuthorizationTypeEnum.Function))
            .Functions(functions => functions
                       .ServiceBus(ServiceBusConstants.ConnectionName, serviceBus => serviceBus
                                   .SubscriptionFunction <GameOrdersCountUpdatedCommand>(
                                       AzureServiceBusConstants.GameTopicName,
                                       AzureServiceBusConstants.GameOrdersCountUpdatedSubscription)
                                   .SubscriptionFunction <GameRatingUpdatedCommand>(
                                       AzureServiceBusConstants.GameTopicName,
                                       AzureServiceBusConstants.GameRatingUpdatedSubscription)));
        }