Browse Source

Warnings update

pull/216/head
Galip Tolga Erdem 3 years ago
parent
commit
e9a5ac4f9a
  1. 2
      apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/UserBasketProvider.cs
  2. 6
      services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs
  3. 2
      services/basket/src/EShopOnAbp.BasketService/Entities/Basket.cs
  4. 2
      services/basket/src/EShopOnAbp.BasketService/Entities/BasketRepository.cs
  5. 4
      services/basket/src/EShopOnAbp.BasketService/Services/BasketProductService.cs

2
apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/UserBasketProvider.cs

@ -45,7 +45,7 @@ namespace EShopOnAbp.PublicWeb.ServiceProviders
}); });
} }
return anonymousUserId; return await Task.FromResult(anonymousUserId);
} }
} }
} }

6
services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs

@ -35,7 +35,7 @@ public class BasketServiceModule : AbpModule
{ {
PreConfigure<AbpHttpClientBuilderOptions>(options => PreConfigure<AbpHttpClientBuilderOptions>(options =>
{ {
options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => options.ProxyClientBuildActions.Add((_, clientBuilder) =>
{ {
clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => clientBuilder.AddTransientHttpErrorPolicy(policyBuilder =>
policyBuilder.WaitAndRetryAsync( policyBuilder.WaitAndRetryAsync(
@ -132,7 +132,7 @@ public class BasketServiceModule : AbpModule
{ {
builder builder
.WithOrigins( .WithOrigins(
configuration["App:CorsOrigins"] configuration["App:CorsOrigins"]!
.Split(",", StringSplitOptions.RemoveEmptyEntries) .Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.Trim().RemovePostFix("/")) .Select(o => o.Trim().RemovePostFix("/"))
.ToArray() .ToArray()
@ -164,7 +164,7 @@ public class BasketServiceModule : AbpModule
var catalogServiceConfiguration = remoteServiceOptions.RemoteServices.GetConfigurationOrDefault("Catalog"); var catalogServiceConfiguration = remoteServiceOptions.RemoteServices.GetConfigurationOrDefault("Catalog");
var catalogGrpcUrl = catalogServiceConfiguration.GetOrDefault("GrpcUrl"); var catalogGrpcUrl = catalogServiceConfiguration.GetOrDefault("GrpcUrl");
options.Address = new Uri(catalogGrpcUrl); if (catalogGrpcUrl != null) options.Address = new Uri(catalogGrpcUrl);
}); });
} }

2
services/basket/src/EShopOnAbp.BasketService/Entities/Basket.cs

@ -4,7 +4,7 @@ namespace EShopOnAbp.BasketService.Entities;
public class Basket : AggregateRoot<Guid> public class Basket : AggregateRoot<Guid>
{ {
public List<BasketItem> Items { get; set; } public List<BasketItem> Items { get; set; } = new();
private Basket() private Basket()
{ {

2
services/basket/src/EShopOnAbp.BasketService/Entities/BasketRepository.cs

@ -15,7 +15,7 @@ public class BasketRepository : IBasketRepository
public async Task<Basket> GetAsync(Guid id) public async Task<Basket> GetAsync(Guid id)
{ {
return await _cache.GetOrAddAsync(id, () => Task.FromResult(new Basket(id))); return (await _cache.GetOrAddAsync(id, () => Task.FromResult(new Basket(id))))!;
} }
public async Task UpdateAsync(Basket basket) public async Task UpdateAsync(Basket basket)

4
services/basket/src/EShopOnAbp.BasketService/Services/BasketProductService.cs

@ -28,10 +28,10 @@ public class BasketProductService : IBasketProductService, ITransientDependency
public async Task<ProductDto> GetAsync(Guid productId) public async Task<ProductDto> GetAsync(Guid productId)
{ {
return await _cache.GetOrAddAsync( return (await _cache.GetOrAddAsync(
productId, productId,
() => GetProductAsync(productId) () => GetProductAsync(productId)
); ))!;
} }
private async Task<ProductDto> GetProductAsync(Guid productId) private async Task<ProductDto> GetProductAsync(Guid productId)

Loading…
Cancel
Save