protected async Task <(bool result, dynamic contentValue)> HandleMessageContentAsync(HttpContent httpContent)
        {
            (bool result, dynamic contentValue) = await HttpContentReader.ReadAsync(httpContent);

            if (!result)
            {
                Logger.ContentNotSupported(httpContent.GetType().FullName);
                return(false, default);
Exemplo n.º 2
0
        private void ConfigureBusinessLayer(IServiceCollection services)
        {
            var contentConfig     = Configuration.GetSection("Content").Get <ContentConfig>();
            var httpContentReader = new HttpContentReader(contentConfig.Url);
            var sampleDataReader  = new SampleDataReader(contentConfig.Albums, contentConfig.Photos, httpContentReader);

            services.AddSingleton(typeof(ISampleDataReader), provider => sampleDataReader);

            services.AddTransient <IAlbumRepository, AlbumRepository>();
            services.AddTransient <IAlbumService, AlbumService>();
        }