Shady nagy/net6 (#614)

* udated to .net6

* used the .net6 version RC2

* added editconfig.

* App core new Scoped Namespaces style.

* BlazorAdmin new Scoped Namespaces style.

* Blazor Shared new Scoped Namespaces style.

* Infra new Scoped Namespaces style.

* public api new Scoped Namespaces style.

* web new Scoped Namespaces style.

* FunctionalTests new Scoped Namespaces style.

* Integrational tests new Scoped Namespaces style.

* unit tests new Scoped Namespaces style.

* update github action.

* update github action.

* change the global.
This commit is contained in:
Shady Nagy
2021-11-06 01:55:48 +02:00
committed by GitHub
parent 64f150dc07
commit 9db2feb930
252 changed files with 6307 additions and 6413 deletions

134
.editorconfig Normal file
View File

@@ -0,0 +1,134 @@
###############################
# Core EditorConfig Options #
###############################
root = true
# All files
[*]
indent_style = space
# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
# Namespaces
csharp_style_namespace_declarations = file_scoped:warning
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
###############################
# VB Coding Conventions #
###############################
[*.vb]
# Modifier preferences
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion

View File

@@ -12,7 +12,8 @@ jobs:
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
dotnet-version: '5.0.x' dotnet-version: '6.0.x'
include-prerelease: true
- name: Build with dotnet - name: Build with dotnet
run: dotnet build ./eShopOnWeb.sln --configuration Release run: dotnet build ./eShopOnWeb.sln --configuration Release

6
global.json Normal file
View File

@@ -0,0 +1,6 @@
{
"sdk": {
"version": "6.0.x",
"rollForward": "latestFeature"
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace>Microsoft.eShopWeb.ApplicationCore</RootNamespace> <RootNamespace>Microsoft.eShopWeb.ApplicationCore</RootNamespace>
</PropertyGroup> </PropertyGroup>

View File

@@ -1,7 +1,6 @@
namespace Microsoft.eShopWeb namespace Microsoft.eShopWeb;
{
public class CatalogSettings public class CatalogSettings
{ {
public string CatalogBaseUrl { get; set; } public string CatalogBaseUrl { get; set; }
} }
}

View File

@@ -1,5 +1,5 @@
namespace Microsoft.eShopWeb.ApplicationCore.Constants namespace Microsoft.eShopWeb.ApplicationCore.Constants;
{
public class AuthorizationConstants public class AuthorizationConstants
{ {
public const string AUTH_KEY = "AuthKeyOfDoomThatMustBeAMinimumNumberOfBytes"; public const string AUTH_KEY = "AuthKeyOfDoomThatMustBeAMinimumNumberOfBytes";
@@ -10,4 +10,3 @@
// TODO: Change this to an environment variable // TODO: Change this to an environment variable
public const string JWT_SECRET_KEY = "SecretKeyOfDoomThatMustBeAMinimumNumberOfBytes"; public const string JWT_SECRET_KEY = "SecretKeyOfDoomThatMustBeAMinimumNumberOfBytes";
} }
}

View File

@@ -1,9 +1,8 @@
namespace Microsoft.eShopWeb.ApplicationCore.Entities namespace Microsoft.eShopWeb.ApplicationCore.Entities;
{
// This can easily be modified to be BaseEntity<T> and public T Id to support different key types. // This can easily be modified to be BaseEntity<T> and public T Id to support different key types.
// Using non-generic integer types for simplicity and to ease caching logic // Using non-generic integer types for simplicity and to ease caching logic
public abstract class BaseEntity public abstract class BaseEntity
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
} }
}

View File

@@ -1,9 +1,9 @@
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate
{
public class Basket : BaseEntity, IAggregateRoot public class Basket : BaseEntity, IAggregateRoot
{ {
public string BuyerId { get; private set; } public string BuyerId { get; private set; }
@@ -36,4 +36,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate
BuyerId = buyerId; BuyerId = buyerId;
} }
} }
}

View File

@@ -1,7 +1,7 @@
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate namespace Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
{
public class BasketItem : BaseEntity public class BasketItem : BaseEntity
{ {
@@ -31,4 +31,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate
Quantity = quantity; Quantity = quantity;
} }
} }
}

View File

@@ -1,9 +1,9 @@
using Ardalis.GuardClauses; using System.Collections.Generic;
using Ardalis.GuardClauses;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using System.Collections.Generic;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.BuyerAggregate namespace Microsoft.eShopWeb.ApplicationCore.Entities.BuyerAggregate;
{
public class Buyer : BaseEntity, IAggregateRoot public class Buyer : BaseEntity, IAggregateRoot
{ {
public string IdentityGuid { get; private set; } public string IdentityGuid { get; private set; }
@@ -23,4 +23,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities.BuyerAggregate
IdentityGuid = identity; IdentityGuid = identity;
} }
} }
}

View File

@@ -1,9 +1,8 @@
namespace Microsoft.eShopWeb.ApplicationCore.Entities.BuyerAggregate namespace Microsoft.eShopWeb.ApplicationCore.Entities.BuyerAggregate;
{
public class PaymentMethod : BaseEntity public class PaymentMethod : BaseEntity
{ {
public string Alias { get; private set; } public string Alias { get; private set; }
public string CardId { get; private set; } // actual card data must be stored in a PCI compliant system, like Stripe public string CardId { get; private set; } // actual card data must be stored in a PCI compliant system, like Stripe
public string Last4 { get; private set; } public string Last4 { get; private set; }
} }
}

View File

@@ -1,7 +1,7 @@
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.ApplicationCore.Entities namespace Microsoft.eShopWeb.ApplicationCore.Entities;
{
public class CatalogBrand : BaseEntity, IAggregateRoot public class CatalogBrand : BaseEntity, IAggregateRoot
{ {
public string Brand { get; private set; } public string Brand { get; private set; }
@@ -10,4 +10,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities
Brand = brand; Brand = brand;
} }
} }
}

View File

@@ -1,9 +1,9 @@
using Ardalis.GuardClauses; using System;
using Ardalis.GuardClauses;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using System;
namespace Microsoft.eShopWeb.ApplicationCore.Entities namespace Microsoft.eShopWeb.ApplicationCore.Entities;
{
public class CatalogItem : BaseEntity, IAggregateRoot public class CatalogItem : BaseEntity, IAggregateRoot
{ {
public string Name { get; private set; } public string Name { get; private set; }
@@ -63,4 +63,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities
PictureUri = $"images\\products\\{pictureName}?{new DateTime().Ticks}"; PictureUri = $"images\\products\\{pictureName}?{new DateTime().Ticks}";
} }
} }
}

View File

@@ -1,7 +1,7 @@
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.ApplicationCore.Entities namespace Microsoft.eShopWeb.ApplicationCore.Entities;
{
public class CatalogType : BaseEntity, IAggregateRoot public class CatalogType : BaseEntity, IAggregateRoot
{ {
public string Type { get; private set; } public string Type { get; private set; }
@@ -10,4 +10,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities
Type = type; Type = type;
} }
} }
}

View File

@@ -1,5 +1,5 @@
namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
{
public class Address // ValueObject public class Address // ValueObject
{ {
public string Street { get; private set; } public string Street { get; private set; }
@@ -23,4 +23,3 @@
ZipCode = zipcode; ZipCode = zipcode;
} }
} }
}

View File

@@ -1,7 +1,7 @@
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
{
/// <summary> /// <summary>
/// Represents a snapshot of the item that was ordered. If catalog item details change, details of /// Represents a snapshot of the item that was ordered. If catalog item details change, details of
/// the item that was part of a completed order should not change. /// the item that was part of a completed order should not change.
@@ -28,4 +28,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate
public string ProductName { get; private set; } public string ProductName { get; private set; }
public string PictureUri { get; private set; } public string PictureUri { get; private set; }
} }
}

View File

@@ -1,10 +1,10 @@
using Ardalis.GuardClauses; using System;
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Ardalis.GuardClauses;
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate
{
public class Order : BaseEntity, IAggregateRoot public class Order : BaseEntity, IAggregateRoot
{ {
private Order() private Order()
@@ -49,4 +49,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate
return total; return total;
} }
} }
}

View File

@@ -1,5 +1,5 @@
namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
{
public class OrderItem : BaseEntity public class OrderItem : BaseEntity
{ {
public CatalogItemOrdered ItemOrdered { get; private set; } public CatalogItemOrdered ItemOrdered { get; private set; }
@@ -18,4 +18,3 @@
Units = units; Units = units;
} }
} }
}

View File

@@ -1,11 +1,10 @@
using System; using System;
namespace Microsoft.eShopWeb.ApplicationCore.Exceptions namespace Microsoft.eShopWeb.ApplicationCore.Exceptions;
{
public class BasketNotFoundException : Exception public class BasketNotFoundException : Exception
{ {
public BasketNotFoundException(int basketId) : base($"No basket found with id {basketId}") public BasketNotFoundException(int basketId) : base($"No basket found with id {basketId}")
{ {
} }
} }
}

View File

@@ -1,7 +1,6 @@
using System; using System;
namespace Microsoft.eShopWeb.ApplicationCore.Exceptions namespace Microsoft.eShopWeb.ApplicationCore.Exceptions;
{
public class DuplicateException : Exception public class DuplicateException : Exception
{ {
@@ -11,4 +10,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Exceptions
} }
} }
}

View File

@@ -1,7 +1,7 @@
using System; using System;
namespace Microsoft.eShopWeb.ApplicationCore.Exceptions namespace Microsoft.eShopWeb.ApplicationCore.Exceptions;
{
public class EmptyBasketOnCheckoutException : Exception public class EmptyBasketOnCheckoutException : Exception
{ {
public EmptyBasketOnCheckoutException() public EmptyBasketOnCheckoutException()
@@ -21,4 +21,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Exceptions
{ {
} }
} }
}

View File

@@ -1,10 +1,10 @@
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; using System.Collections.Generic;
using Microsoft.eShopWeb.ApplicationCore.Exceptions;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
using Microsoft.eShopWeb.ApplicationCore.Exceptions;
namespace Ardalis.GuardClauses;
namespace Ardalis.GuardClauses
{
public static class BasketGuards public static class BasketGuards
{ {
public static void NullBasket(this IGuardClause guardClause, int basketId, Basket basket) public static void NullBasket(this IGuardClause guardClause, int basketId, Basket basket)
@@ -19,4 +19,3 @@ namespace Ardalis.GuardClauses
throw new EmptyBasketOnCheckoutException(); throw new EmptyBasketOnCheckoutException();
} }
} }
}

View File

@@ -1,7 +1,7 @@
using System.Text.Json; using System.Text.Json;
namespace Microsoft.eShopWeb namespace Microsoft.eShopWeb;
{
public static class JsonExtensions public static class JsonExtensions
{ {
private static readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions private static readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions
@@ -15,4 +15,3 @@ namespace Microsoft.eShopWeb
public static string ToJson<T>(this T obj) => public static string ToJson<T>(this T obj) =>
JsonSerializer.Serialize<T>(obj, _jsonOptions); JsonSerializer.Serialize<T>(obj, _jsonOptions);
} }
}

View File

@@ -1,5 +1,4 @@
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
{
public interface IAggregateRoot public interface IAggregateRoot
{ } { }
}

View File

@@ -1,5 +1,5 @@
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
{
/// <summary> /// <summary>
/// This type eliminates the need to depend directly on the ASP.NET Core logging types. /// This type eliminates the need to depend directly on the ASP.NET Core logging types.
/// </summary> /// </summary>
@@ -9,4 +9,3 @@
void LogInformation(string message, params object[] args); void LogInformation(string message, params object[] args);
void LogWarning(string message, params object[] args); void LogWarning(string message, params object[] args);
} }
}

View File

@@ -1,9 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
{
public interface IBasketQueryService public interface IBasketQueryService
{ {
Task<int> CountTotalBasketItems(string username); Task<int> CountTotalBasketItems(string username);
} }
}

View File

@@ -1,9 +1,9 @@
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
{
public interface IBasketService public interface IBasketService
{ {
Task TransferBasketAsync(string anonymousId, string userName); Task TransferBasketAsync(string anonymousId, string userName);
@@ -11,4 +11,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
Task<Basket> SetQuantities(int basketId, Dictionary<string, int> quantities); Task<Basket> SetQuantities(int basketId, Dictionary<string, int> quantities);
Task DeleteBasketAsync(int basketId); Task DeleteBasketAsync(int basketId);
} }
}

View File

@@ -1,10 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
{
public interface IEmailSender public interface IEmailSender
{ {
Task SendEmailAsync(string email, string subject, string message); Task SendEmailAsync(string email, string subject, string message);
} }
}

View File

@@ -1,10 +1,9 @@
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; using System.Threading.Tasks;
using System.Threading.Tasks; using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
{
public interface IOrderService public interface IOrderService
{ {
Task CreateOrderAsync(int basketId, Address shippingAddress); Task CreateOrderAsync(int basketId, Address shippingAddress);
} }
}

View File

@@ -1,8 +1,7 @@
using Ardalis.Specification; using Ardalis.Specification;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
{
public interface IReadRepository<T> : IReadRepositoryBase<T> where T : class, IAggregateRoot public interface IReadRepository<T> : IReadRepositoryBase<T> where T : class, IAggregateRoot
{ {
} }
}

View File

@@ -1,8 +1,7 @@
using Ardalis.Specification; using Ardalis.Specification;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
{
public interface IRepository<T> : IRepositoryBase<T> where T : class, IAggregateRoot public interface IRepository<T> : IRepositoryBase<T> where T : class, IAggregateRoot
{ {
} }
}

View File

@@ -1,9 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
{
public interface ITokenClaimsService public interface ITokenClaimsService
{ {
Task<string> GetTokenAsync(string userName); Task<string> GetTokenAsync(string userName);
} }
}

View File

@@ -1,7 +1,6 @@
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces namespace Microsoft.eShopWeb.ApplicationCore.Interfaces;
{
public interface IUriComposer public interface IUriComposer
{ {
string ComposePicUri(string uriTemplate); string ComposePicUri(string uriTemplate);
} }
}

View File

@@ -1,12 +1,12 @@
using Ardalis.GuardClauses; using System.Collections.Generic;
using System.Threading.Tasks;
using Ardalis.GuardClauses;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Microsoft.eShopWeb.ApplicationCore.Specifications; using Microsoft.eShopWeb.ApplicationCore.Specifications;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Microsoft.eShopWeb.ApplicationCore.Services namespace Microsoft.eShopWeb.ApplicationCore.Services;
{
public class BasketService : IBasketService public class BasketService : IBasketService
{ {
private readonly IRepository<Basket> _basketRepository; private readonly IRepository<Basket> _basketRepository;
@@ -84,4 +84,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Services
await _basketRepository.DeleteAsync(anonymousBasket); await _basketRepository.DeleteAsync(anonymousBasket);
} }
} }
}

View File

@@ -1,14 +1,14 @@
using Ardalis.GuardClauses; using System.Linq;
using System.Threading.Tasks;
using Ardalis.GuardClauses;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Microsoft.eShopWeb.ApplicationCore.Specifications; using Microsoft.eShopWeb.ApplicationCore.Specifications;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopWeb.ApplicationCore.Services namespace Microsoft.eShopWeb.ApplicationCore.Services;
{
public class OrderService : IOrderService public class OrderService : IOrderService
{ {
private readonly IRepository<Order> _orderRepository; private readonly IRepository<Order> _orderRepository;
@@ -51,4 +51,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Services
await _orderRepository.AddAsync(order); await _orderRepository.AddAsync(order);
} }
} }
}

View File

@@ -1,7 +1,7 @@
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.ApplicationCore.Services namespace Microsoft.eShopWeb.ApplicationCore.Services;
{
public class UriComposer : IUriComposer public class UriComposer : IUriComposer
{ {
private readonly CatalogSettings _catalogSettings; private readonly CatalogSettings _catalogSettings;
@@ -13,4 +13,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Services
return uriTemplate.Replace("http://catalogbaseurltobereplaced", _catalogSettings.CatalogBaseUrl); return uriTemplate.Replace("http://catalogbaseurltobereplaced", _catalogSettings.CatalogBaseUrl);
} }
} }
}

View File

@@ -1,8 +1,8 @@
using Ardalis.Specification; using Ardalis.Specification;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications namespace Microsoft.eShopWeb.ApplicationCore.Specifications;
{
public sealed class BasketWithItemsSpecification : Specification<Basket>, ISingleResultSpecification public sealed class BasketWithItemsSpecification : Specification<Basket>, ISingleResultSpecification
{ {
public BasketWithItemsSpecification(int basketId) public BasketWithItemsSpecification(int basketId)
@@ -19,4 +19,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications
.Include(b => b.Items); .Include(b => b.Items);
} }
} }
}

View File

@@ -1,8 +1,8 @@
using Ardalis.Specification; using Ardalis.Specification;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications namespace Microsoft.eShopWeb.ApplicationCore.Specifications;
{
public class CatalogFilterPaginatedSpecification : Specification<CatalogItem> public class CatalogFilterPaginatedSpecification : Specification<CatalogItem>
{ {
public CatalogFilterPaginatedSpecification(int skip, int take, int? brandId, int? typeId) public CatalogFilterPaginatedSpecification(int skip, int take, int? brandId, int? typeId)
@@ -18,4 +18,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications
.Skip(skip).Take(take); .Skip(skip).Take(take);
} }
} }
}

View File

@@ -1,8 +1,8 @@
using Ardalis.Specification; using Ardalis.Specification;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications namespace Microsoft.eShopWeb.ApplicationCore.Specifications;
{
public class CatalogFilterSpecification : Specification<CatalogItem> public class CatalogFilterSpecification : Specification<CatalogItem>
{ {
public CatalogFilterSpecification(int? brandId, int? typeId) public CatalogFilterSpecification(int? brandId, int? typeId)
@@ -11,4 +11,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications
(!typeId.HasValue || i.CatalogTypeId == typeId)); (!typeId.HasValue || i.CatalogTypeId == typeId));
} }
} }
}

View File

@@ -1,8 +1,8 @@
using Ardalis.Specification; using Ardalis.Specification;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications namespace Microsoft.eShopWeb.ApplicationCore.Specifications;
{
public class CatalogItemNameSpecification : Specification<CatalogItem> public class CatalogItemNameSpecification : Specification<CatalogItem>
{ {
public CatalogItemNameSpecification(string catalogItemName) public CatalogItemNameSpecification(string catalogItemName)
@@ -10,4 +10,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications
Query.Where(item => catalogItemName == item.Name); Query.Where(item => catalogItemName == item.Name);
} }
} }
}

View File

@@ -1,10 +1,10 @@
using Ardalis.Specification; using System;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using System;
using System.Linq; using System.Linq;
using Ardalis.Specification;
using Microsoft.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications
{
public class CatalogItemsSpecification : Specification<CatalogItem> public class CatalogItemsSpecification : Specification<CatalogItem>
{ {
public CatalogItemsSpecification(params int[] ids) public CatalogItemsSpecification(params int[] ids)
@@ -12,4 +12,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications
Query.Where(c => ids.Contains(c.Id)); Query.Where(c => ids.Contains(c.Id));
} }
} }
}

View File

@@ -1,8 +1,8 @@
using Ardalis.Specification; using Ardalis.Specification;
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications namespace Microsoft.eShopWeb.ApplicationCore.Specifications;
{
public class CustomerOrdersWithItemsSpecification : Specification<Order> public class CustomerOrdersWithItemsSpecification : Specification<Order>
{ {
public CustomerOrdersWithItemsSpecification(string buyerId) public CustomerOrdersWithItemsSpecification(string buyerId)
@@ -12,4 +12,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications
.ThenInclude(i => i.ItemOrdered); .ThenInclude(i => i.ItemOrdered);
} }
} }
}

View File

@@ -1,8 +1,8 @@
using Ardalis.Specification; using Ardalis.Specification;
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
namespace Microsoft.eShopWeb.ApplicationCore.Specifications namespace Microsoft.eShopWeb.ApplicationCore.Specifications;
{
public class OrderWithItemsByIdSpec : Specification<Order>, ISingleResultSpecification public class OrderWithItemsByIdSpec : Specification<Order>, ISingleResultSpecification
{ {
public OrderWithItemsByIdSpec(int orderId) public OrderWithItemsByIdSpec(int orderId)
@@ -13,4 +13,3 @@ namespace Microsoft.eShopWeb.ApplicationCore.Specifications
.ThenInclude(i => i.ItemOrdered); .ThenInclude(i => i.ItemOrdered);
} }
} }
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,15 +1,15 @@
using BlazorShared.Authorization; using System;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.Logging;
using System;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Security.Claims; using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using BlazorShared.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.Logging;
namespace BlazorAdmin;
namespace BlazorAdmin
{
public class CustomAuthStateProvider : AuthenticationStateProvider public class CustomAuthStateProvider : AuthenticationStateProvider
{ {
// TODO: Get Default Cache Duration from Config // TODO: Get Default Cache Duration from Config
@@ -84,4 +84,3 @@ namespace BlazorAdmin
return new ClaimsPrincipal(identity); return new ClaimsPrincipal(identity);
} }
} }
}

View File

@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace BlazorAdmin.Helpers namespace BlazorAdmin.Helpers;
{
public class BlazorComponent : ComponentBase public class BlazorComponent : ComponentBase
{ {
private readonly RefreshBroadcast _refresh = RefreshBroadcast.Instance; private readonly RefreshBroadcast _refresh = RefreshBroadcast.Instance;
@@ -23,4 +23,3 @@ namespace BlazorAdmin.Helpers
} }
} }
}

View File

@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace BlazorAdmin.Helpers namespace BlazorAdmin.Helpers;
{
public class BlazorLayoutComponent : LayoutComponentBase public class BlazorLayoutComponent : LayoutComponentBase
{ {
private readonly RefreshBroadcast _refresh = RefreshBroadcast.Instance; private readonly RefreshBroadcast _refresh = RefreshBroadcast.Instance;
@@ -22,4 +22,3 @@ namespace BlazorAdmin.Helpers
StateHasChanged(); StateHasChanged();
} }
} }
}

View File

@@ -1,7 +1,7 @@
using System; using System;
namespace BlazorAdmin.Helpers namespace BlazorAdmin.Helpers;
{
internal sealed class RefreshBroadcast internal sealed class RefreshBroadcast
{ {
private static readonly Lazy<RefreshBroadcast> private static readonly Lazy<RefreshBroadcast>
@@ -21,4 +21,3 @@ namespace BlazorAdmin.Helpers
RefreshRequested?.Invoke(); RefreshRequested?.Invoke();
} }
} }
}

View File

@@ -1,9 +1,9 @@
using BlazorAdmin.Services; using System;
using BlazorAdmin.Services;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using System;
namespace BlazorAdmin.Helpers namespace BlazorAdmin.Helpers;
{
public class ToastComponent : ComponentBase, IDisposable public class ToastComponent : ComponentBase, IDisposable
{ {
[Inject] [Inject]
@@ -85,4 +85,3 @@ namespace BlazorAdmin.Helpers
ToastService.OnShow -= ShowToast; ToastService.OnShow -= ShowToast;
} }
} }
}

View File

@@ -1,8 +1,8 @@
using Microsoft.JSInterop; using System.Threading.Tasks;
using System.Threading.Tasks; using Microsoft.JSInterop;
namespace BlazorAdmin.JavaScript;
namespace BlazorAdmin.JavaScript
{
public class Cookies public class Cookies
{ {
private readonly IJSRuntime _jsRuntime; private readonly IJSRuntime _jsRuntime;
@@ -22,4 +22,3 @@ namespace BlazorAdmin.JavaScript
return await _jsRuntime.InvokeAsync<string>(JSInteropConstants.GetCookie, name); return await _jsRuntime.InvokeAsync<string>(JSInteropConstants.GetCookie, name);
} }
} }
}

View File

@@ -1,8 +1,8 @@
using Microsoft.JSInterop; using System.Threading.Tasks;
using System.Threading.Tasks; using Microsoft.JSInterop;
namespace BlazorAdmin.JavaScript;
namespace BlazorAdmin.JavaScript
{
public class Css public class Css
{ {
private readonly IJSRuntime _jsRuntime; private readonly IJSRuntime _jsRuntime;
@@ -22,4 +22,3 @@ namespace BlazorAdmin.JavaScript
return await _jsRuntime.InvokeAsync<string>(JSInteropConstants.HideBodyOverflow); return await _jsRuntime.InvokeAsync<string>(JSInteropConstants.HideBodyOverflow);
} }
} }
}

View File

@@ -1,5 +1,5 @@
namespace BlazorAdmin.JavaScript namespace BlazorAdmin.JavaScript;
{
public static class JSInteropConstants public static class JSInteropConstants
{ {
public static string DeleteCookie => "deleteCookie"; public static string DeleteCookie => "deleteCookie";
@@ -8,4 +8,3 @@
public static string HideBodyOverflow => "hideBodyOverflow"; public static string HideBodyOverflow => "hideBodyOverflow";
public static string ShowBodyOverflow => "showBodyOverflow"; public static string ShowBodyOverflow => "showBodyOverflow";
} }
}

View File

@@ -1,8 +1,8 @@
using Microsoft.JSInterop; using System.Threading.Tasks;
using System.Threading.Tasks; using Microsoft.JSInterop;
namespace BlazorAdmin.JavaScript;
namespace BlazorAdmin.JavaScript
{
public class Route public class Route
{ {
private readonly IJSRuntime _jsRuntime; private readonly IJSRuntime _jsRuntime;
@@ -17,4 +17,3 @@ namespace BlazorAdmin.JavaScript
await _jsRuntime.InvokeAsync<string>(JSInteropConstants.RouteOutside, path); await _jsRuntime.InvokeAsync<string>(JSInteropConstants.RouteOutside, path);
} }
} }
}

View File

@@ -1,11 +1,11 @@
using BlazorAdmin.Helpers; using System.Collections.Generic;
using System.Threading.Tasks;
using BlazorAdmin.Helpers;
using BlazorShared.Interfaces; using BlazorShared.Interfaces;
using BlazorShared.Models; using BlazorShared.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace BlazorAdmin.Pages.CatalogItemPage namespace BlazorAdmin.Pages.CatalogItemPage;
{
public partial class List : BlazorComponent public partial class List : BlazorComponent
{ {
[Microsoft.AspNetCore.Components.Inject] [Microsoft.AspNetCore.Components.Inject]
@@ -66,4 +66,3 @@ namespace BlazorAdmin.Pages.CatalogItemPage
StateHasChanged(); StateHasChanged();
} }
} }
}

View File

@@ -1,3 +1,6 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using BlazorAdmin.Services; using BlazorAdmin.Services;
using Blazored.LocalStorage; using Blazored.LocalStorage;
using BlazorShared; using BlazorShared;
@@ -7,12 +10,9 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace BlazorAdmin namespace BlazorAdmin;
{
public class Program public class Program
{ {
public static async Task Main(string[] args) public static async Task Main(string[] args)
@@ -53,4 +53,3 @@ namespace BlazorAdmin
await localStorageService.RemoveItemAsync(typeof(CatalogType).Name); await localStorageService.RemoveItemAsync(typeof(CatalogType).Name);
} }
} }
}

View File

@@ -1,7 +1,7 @@
using System; using System;
namespace BlazorAdmin.Services namespace BlazorAdmin.Services;
{
public class CacheEntry<T> public class CacheEntry<T>
{ {
public CacheEntry(T item) public CacheEntry(T item)
@@ -16,4 +16,3 @@ namespace BlazorAdmin.Services
public T Value { get; set; } public T Value { get; set; }
public DateTime DateCreated { get; set; } = DateTime.UtcNow; public DateTime DateCreated { get; set; } = DateTime.UtcNow;
} }
}

View File

@@ -1,14 +1,14 @@
using Blazored.LocalStorage; using System;
using BlazorShared.Interfaces;
using BlazorShared.Models;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Blazored.LocalStorage;
using BlazorShared.Interfaces;
using BlazorShared.Models;
using Microsoft.Extensions.Logging;
namespace BlazorAdmin.Services;
namespace BlazorAdmin.Services
{
public class CachedCatalogItemServiceDecorator : ICatalogItemService public class CachedCatalogItemServiceDecorator : ICatalogItemService
{ {
private readonly ILocalStorageService _localStorageService; private readonly ILocalStorageService _localStorageService;
@@ -111,4 +111,3 @@ namespace BlazorAdmin.Services
await _localStorageService.SetItemAsync(key, entry); await _localStorageService.SetItemAsync(key, entry);
} }
} }
}

View File

@@ -1,13 +1,13 @@
using Blazored.LocalStorage; using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Blazored.LocalStorage;
using BlazorShared.Interfaces; using BlazorShared.Interfaces;
using BlazorShared.Models; using BlazorShared.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace BlazorAdmin.Services namespace BlazorAdmin.Services;
{
public class CachedCatalogLookupDataServiceDecorator<TLookupData, TReponse> public class CachedCatalogLookupDataServiceDecorator<TLookupData, TReponse>
: ICatalogLookupDataService<TLookupData> : ICatalogLookupDataService<TLookupData>
where TLookupData : LookupData where TLookupData : LookupData
@@ -50,4 +50,3 @@ namespace BlazorAdmin.Services
return types; return types;
} }
} }
}

View File

@@ -1,13 +1,13 @@
using BlazorShared.Interfaces; using System.Collections.Generic;
using BlazorShared.Models;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using BlazorShared.Interfaces;
using BlazorShared.Models;
using Microsoft.Extensions.Logging;
namespace BlazorAdmin.Services namespace BlazorAdmin.Services;
{
public class CatalogItemService : ICatalogItemService public class CatalogItemService : ICatalogItemService
{ {
private readonly ICatalogLookupDataService<CatalogBrand> _brandService; private readonly ICatalogLookupDataService<CatalogBrand> _brandService;
@@ -94,4 +94,3 @@ namespace BlazorAdmin.Services
return items; return items;
} }
} }
}

View File

@@ -1,17 +1,17 @@
using BlazorShared; using System.Collections.Generic;
using BlazorShared.Attributes;
using BlazorShared.Interfaces;
using BlazorShared.Models;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using BlazorShared;
using BlazorShared.Attributes;
using BlazorShared.Interfaces;
using BlazorShared.Models;
using Microsoft.Extensions.Logging;
namespace BlazorAdmin.Services;
namespace BlazorAdmin.Services
{
public class CatalogLookupDataService<TLookupData, TReponse> public class CatalogLookupDataService<TLookupData, TReponse>
: ICatalogLookupDataService<TLookupData> : ICatalogLookupDataService<TLookupData>
where TLookupData : LookupData where TLookupData : LookupData
@@ -40,4 +40,3 @@ namespace BlazorAdmin.Services
return response.List; return response.List;
} }
} }
}

View File

@@ -1,12 +1,12 @@
using BlazorShared; using System.Net.Http;
using BlazorShared.Models;
using System.Net.Http;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using BlazorShared;
using BlazorShared.Models;
namespace BlazorAdmin.Services;
namespace BlazorAdmin.Services
{
public class HttpService public class HttpService
{ {
private readonly HttpClient _httpClient; private readonly HttpClient _httpClient;
@@ -93,4 +93,3 @@ namespace BlazorAdmin.Services
}); });
} }
} }
}

View File

@@ -1,8 +1,8 @@
using System; using System;
using System.Timers; using System.Timers;
namespace BlazorAdmin.Services namespace BlazorAdmin.Services;
{
public enum ToastLevel public enum ToastLevel
{ {
Info, Info,
@@ -52,4 +52,3 @@ namespace BlazorAdmin.Services
Countdown?.Dispose(); Countdown?.Dispose();
} }
} }
}

View File

@@ -3,8 +3,8 @@ using BlazorShared.Interfaces;
using BlazorShared.Models; using BlazorShared.Models;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace BlazorAdmin namespace BlazorAdmin;
{
public static class ServicesConfiguration public static class ServicesConfiguration
{ {
public static IServiceCollection AddBlazorServices(this IServiceCollection services) public static IServiceCollection AddBlazorServices(this IServiceCollection services)
@@ -19,4 +19,3 @@ namespace BlazorAdmin
return services; return services;
} }
} }
}

View File

@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Forms;
namespace BlazorAdmin.Shared namespace BlazorAdmin.Shared;
{
/// <summary> /// <summary>
/// This is needed until 5.0 ships with native support /// This is needed until 5.0 ships with native support
/// https://www.pragimtech.com/blog/blazor/inputselect-does-not-support-system.int32/ /// https://www.pragimtech.com/blog/blazor/inputselect-does-not-support-system.int32/
@@ -35,4 +35,3 @@ namespace BlazorAdmin.Shared
} }
} }
} }
}

View File

@@ -1,9 +1,8 @@
using System; using System;
namespace BlazorShared.Attributes namespace BlazorShared.Attributes;
{
public class EndpointAttribute : Attribute public class EndpointAttribute : Attribute
{ {
public string Name { get; set; } public string Name { get; set; }
} }
}

View File

@@ -1,5 +1,5 @@
namespace BlazorShared.Authorization namespace BlazorShared.Authorization;
{
public class ClaimValue public class ClaimValue
{ {
public ClaimValue() public ClaimValue()
@@ -15,4 +15,3 @@
public string Type { get; set; } public string Type { get; set; }
public string Value { get; set; } public string Value { get; set; }
} }
}

View File

@@ -1,5 +1,5 @@
namespace BlazorShared.Authorization namespace BlazorShared.Authorization;
{
public static class Constants public static class Constants
{ {
public static class Roles public static class Roles
@@ -7,4 +7,3 @@
public const string ADMINISTRATORS = "Administrators"; public const string ADMINISTRATORS = "Administrators";
} }
} }
}

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace BlazorShared.Authorization namespace BlazorShared.Authorization;
{
public class UserInfo public class UserInfo
{ {
public static readonly UserInfo Anonymous = new UserInfo(); public static readonly UserInfo Anonymous = new UserInfo();
@@ -11,4 +11,3 @@ namespace BlazorShared.Authorization
public string Token { get; set; } public string Token { get; set; }
public IEnumerable<ClaimValue> Claims { get; set; } public IEnumerable<ClaimValue> Claims { get; set; }
} }
}

View File

@@ -1,5 +1,5 @@
namespace BlazorShared namespace BlazorShared;
{
public class BaseUrlConfiguration public class BaseUrlConfiguration
{ {
public const string CONFIG_NAME = "baseUrls"; public const string CONFIG_NAME = "baseUrls";
@@ -7,4 +7,3 @@
public string ApiBase { get; set; } public string ApiBase { get; set; }
public string WebBase { get; set; } public string WebBase { get; set; }
} }
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace>BlazorShared</RootNamespace> <RootNamespace>BlazorShared</RootNamespace>
<AssemblyName>BlazorShared</AssemblyName> <AssemblyName>BlazorShared</AssemblyName>
</PropertyGroup> </PropertyGroup>

View File

@@ -2,8 +2,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using BlazorShared.Models; using BlazorShared.Models;
namespace BlazorShared.Interfaces namespace BlazorShared.Interfaces;
{
public interface ICatalogItemService public interface ICatalogItemService
{ {
Task<CatalogItem> Create(CreateCatalogItemRequest catalogItem); Task<CatalogItem> Create(CreateCatalogItemRequest catalogItem);
@@ -13,4 +13,3 @@ namespace BlazorShared.Interfaces
Task<List<CatalogItem>> ListPaged(int pageSize); Task<List<CatalogItem>> ListPaged(int pageSize);
Task<List<CatalogItem>> List(); Task<List<CatalogItem>> List();
} }
}

View File

@@ -1,11 +1,10 @@
using BlazorShared.Models; using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using BlazorShared.Models;
namespace BlazorShared.Interfaces;
namespace BlazorShared.Interfaces
{
public interface ICatalogLookupDataService<TLookupData> where TLookupData : LookupData public interface ICatalogLookupDataService<TLookupData> where TLookupData : LookupData
{ {
Task<List<TLookupData>> List(); Task<List<TLookupData>> List();
} }
}

View File

@@ -1,10 +1,9 @@
using BlazorShared.Models; using System.Collections.Generic;
using System.Collections.Generic; using BlazorShared.Models;
namespace BlazorShared.Interfaces;
namespace BlazorShared.Interfaces
{
public interface ILookupDataResponse<TLookupData> where TLookupData : LookupData public interface ILookupDataResponse<TLookupData> where TLookupData : LookupData
{ {
List<TLookupData> List { get; set; } List<TLookupData> List { get; set; }
} }
}

View File

@@ -1,9 +1,8 @@
using BlazorShared.Attributes; using BlazorShared.Attributes;
namespace BlazorShared.Models namespace BlazorShared.Models;
{
[Endpoint(Name = "catalog-brands")] [Endpoint(Name = "catalog-brands")]
public class CatalogBrand : LookupData public class CatalogBrand : LookupData
{ {
} }
}

View File

@@ -1,12 +1,11 @@
using BlazorShared.Interfaces; using System.Collections.Generic;
using System.Collections.Generic;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using BlazorShared.Interfaces;
namespace BlazorShared.Models;
namespace BlazorShared.Models
{
public class CatalogBrandResponse : ILookupDataResponse<CatalogBrand> public class CatalogBrandResponse : ILookupDataResponse<CatalogBrand>
{ {
[JsonPropertyName("CatalogBrands")] [JsonPropertyName("CatalogBrands")]
public List<CatalogBrand> List { get; set; } = new List<CatalogBrand>(); public List<CatalogBrand> List { get; set; } = new List<CatalogBrand>();
} }
}

View File

@@ -4,8 +4,8 @@ using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using BlazorInputFile; using BlazorInputFile;
namespace BlazorShared.Models namespace BlazorShared.Models;
{
public class CatalogItem public class CatalogItem
{ {
public int Id { get; set; } public int Id { get; set; }
@@ -85,4 +85,3 @@ namespace BlazorShared.Models
string.Equals(extension, ".jpeg", StringComparison.OrdinalIgnoreCase); string.Equals(extension, ".jpeg", StringComparison.OrdinalIgnoreCase);
} }
} }
}

View File

@@ -1,9 +1,8 @@
using BlazorShared.Attributes; using BlazorShared.Attributes;
namespace BlazorShared.Models namespace BlazorShared.Models;
{
[Endpoint(Name = "catalog-types")] [Endpoint(Name = "catalog-types")]
public class CatalogType : LookupData public class CatalogType : LookupData
{ {
} }
}

View File

@@ -1,13 +1,12 @@
using BlazorShared.Interfaces; using System.Collections.Generic;
using System.Collections.Generic;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using BlazorShared.Interfaces;
namespace BlazorShared.Models;
namespace BlazorShared.Models
{
public class CatalogTypeResponse : ILookupDataResponse<CatalogType> public class CatalogTypeResponse : ILookupDataResponse<CatalogType>
{ {
[JsonPropertyName("CatalogTypes")] [JsonPropertyName("CatalogTypes")]
public List<CatalogType> List { get; set; } = new List<CatalogType>(); public List<CatalogType> List { get; set; } = new List<CatalogType>();
} }
}

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace BlazorShared.Models namespace BlazorShared.Models;
{
public class CreateCatalogItemRequest public class CreateCatalogItemRequest
{ {
public int CatalogTypeId { get; set; } public int CatalogTypeId { get; set; }
@@ -25,4 +25,3 @@ namespace BlazorShared.Models
public string PictureName { get; set; } = string.Empty; public string PictureName { get; set; } = string.Empty;
} }
}

View File

@@ -1,7 +1,6 @@
namespace BlazorShared.Models namespace BlazorShared.Models;
{
public class CreateCatalogItemResponse public class CreateCatalogItemResponse
{ {
public CatalogItem CatalogItem { get; set; } = new CatalogItem(); public CatalogItem CatalogItem { get; set; } = new CatalogItem();
} }
}

View File

@@ -1,7 +1,6 @@
namespace BlazorShared.Models namespace BlazorShared.Models;
{
public class DeleteCatalogItemResponse public class DeleteCatalogItemResponse
{ {
public string Status { get; set; } = "Deleted"; public string Status { get; set; } = "Deleted";
} }
}

View File

@@ -1,7 +1,6 @@
namespace BlazorShared.Models namespace BlazorShared.Models;
{
public class EditCatalogItemResult public class EditCatalogItemResult
{ {
public CatalogItem CatalogItem { get; set; } = new CatalogItem(); public CatalogItem CatalogItem { get; set; } = new CatalogItem();
} }
}

View File

@@ -1,7 +1,7 @@
using System.Text.Json; using System.Text.Json;
namespace BlazorShared.Models namespace BlazorShared.Models;
{
public class ErrorDetails public class ErrorDetails
{ {
public int StatusCode { get; set; } public int StatusCode { get; set; }
@@ -11,4 +11,3 @@ namespace BlazorShared.Models
return JsonSerializer.Serialize(this); return JsonSerializer.Serialize(this);
} }
} }
}

View File

@@ -1,8 +1,7 @@
namespace BlazorShared.Models namespace BlazorShared.Models;
{
public abstract class LookupData public abstract class LookupData
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
} }
}

View File

@@ -1,10 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace BlazorShared.Models namespace BlazorShared.Models;
{
public class PagedCatalogItemResponse public class PagedCatalogItemResponse
{ {
public List<CatalogItem> CatalogItems { get; set; } = new List<CatalogItem>(); public List<CatalogItem> CatalogItems { get; set; } = new List<CatalogItem>();
public int PageCount { get; set; } = 0; public int PageCount { get; set; } = 0;
} }
}

View File

@@ -1,10 +1,10 @@
using Microsoft.EntityFrameworkCore; using System.Linq;
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.Infrastructure.Data;
namespace Microsoft.eShopWeb.Infrastructure.Data
{
public class BasketQueryService : IBasketQueryService public class BasketQueryService : IBasketQueryService
{ {
private readonly CatalogContext _dbContext; private readonly CatalogContext _dbContext;
@@ -24,4 +24,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
return totalItems; return totalItems;
} }
} }
}

View File

@@ -1,11 +1,10 @@
using Microsoft.EntityFrameworkCore; using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
using System.Reflection;
namespace Microsoft.eShopWeb.Infrastructure.Data namespace Microsoft.eShopWeb.Infrastructure.Data;
{
public class CatalogContext : DbContext public class CatalogContext : DbContext
{ {
@@ -27,4 +26,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly()); builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
} }
} }
}

View File

@@ -1,12 +1,12 @@
using Microsoft.EntityFrameworkCore; using System;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.Extensions.Logging;
namespace Microsoft.eShopWeb.Infrastructure.Data;
namespace Microsoft.eShopWeb.Infrastructure.Data
{
public class CatalogContextSeed public class CatalogContextSeed
{ {
public static async Task SeedAsync(CatalogContext catalogContext, public static async Task SeedAsync(CatalogContext catalogContext,
@@ -98,4 +98,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data
}; };
} }
} }
}

View File

@@ -2,8 +2,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
namespace Microsoft.eShopWeb.Infrastructure.Data.Config namespace Microsoft.eShopWeb.Infrastructure.Data.Config;
{
public class BasketConfiguration : IEntityTypeConfiguration<Basket> public class BasketConfiguration : IEntityTypeConfiguration<Basket>
{ {
public void Configure(EntityTypeBuilder<Basket> builder) public void Configure(EntityTypeBuilder<Basket> builder)
@@ -16,4 +16,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
.HasMaxLength(256); .HasMaxLength(256);
} }
} }
}

View File

@@ -2,8 +2,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
namespace Microsoft.eShopWeb.Infrastructure.Data.Config namespace Microsoft.eShopWeb.Infrastructure.Data.Config;
{
public class BasketItemConfiguration : IEntityTypeConfiguration<BasketItem> public class BasketItemConfiguration : IEntityTypeConfiguration<BasketItem>
{ {
public void Configure(EntityTypeBuilder<BasketItem> builder) public void Configure(EntityTypeBuilder<BasketItem> builder)
@@ -13,4 +13,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
} }
} }
}

View File

@@ -2,8 +2,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.Infrastructure.Data.Config namespace Microsoft.eShopWeb.Infrastructure.Data.Config;
{
public class CatalogBrandConfiguration : IEntityTypeConfiguration<CatalogBrand> public class CatalogBrandConfiguration : IEntityTypeConfiguration<CatalogBrand>
{ {
public void Configure(EntityTypeBuilder<CatalogBrand> builder) public void Configure(EntityTypeBuilder<CatalogBrand> builder)
@@ -19,4 +19,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
.HasMaxLength(100); .HasMaxLength(100);
} }
} }
}

View File

@@ -2,8 +2,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.Infrastructure.Data.Config namespace Microsoft.eShopWeb.Infrastructure.Data.Config;
{
public class CatalogItemConfiguration : IEntityTypeConfiguration<CatalogItem> public class CatalogItemConfiguration : IEntityTypeConfiguration<CatalogItem>
{ {
public void Configure(EntityTypeBuilder<CatalogItem> builder) public void Configure(EntityTypeBuilder<CatalogItem> builder)
@@ -34,4 +34,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
.HasForeignKey(ci => ci.CatalogTypeId); .HasForeignKey(ci => ci.CatalogTypeId);
} }
} }
}

View File

@@ -2,8 +2,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.Infrastructure.Data.Config namespace Microsoft.eShopWeb.Infrastructure.Data.Config;
{
public class CatalogTypeConfiguration : IEntityTypeConfiguration<CatalogType> public class CatalogTypeConfiguration : IEntityTypeConfiguration<CatalogType>
{ {
public void Configure(EntityTypeBuilder<CatalogType> builder) public void Configure(EntityTypeBuilder<CatalogType> builder)
@@ -19,4 +19,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
.HasMaxLength(100); .HasMaxLength(100);
} }
} }
}

View File

@@ -2,8 +2,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
namespace Microsoft.eShopWeb.Infrastructure.Data.Config namespace Microsoft.eShopWeb.Infrastructure.Data.Config;
{
public class OrderConfiguration : IEntityTypeConfiguration<Order> public class OrderConfiguration : IEntityTypeConfiguration<Order>
{ {
public void Configure(EntityTypeBuilder<Order> builder) public void Configure(EntityTypeBuilder<Order> builder)
@@ -41,4 +41,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
}); });
} }
} }
}

View File

@@ -2,8 +2,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
namespace Microsoft.eShopWeb.Infrastructure.Data.Config namespace Microsoft.eShopWeb.Infrastructure.Data.Config;
{
public class OrderItemConfiguration : IEntityTypeConfiguration<OrderItem> public class OrderItemConfiguration : IEntityTypeConfiguration<OrderItem>
{ {
public void Configure(EntityTypeBuilder<OrderItem> builder) public void Configure(EntityTypeBuilder<OrderItem> builder)
@@ -22,4 +22,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Config
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
} }
} }
}

View File

@@ -1,12 +1,11 @@
using Ardalis.Specification.EntityFrameworkCore; using Ardalis.Specification.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Interfaces; using Microsoft.eShopWeb.ApplicationCore.Interfaces;
namespace Microsoft.eShopWeb.Infrastructure.Data namespace Microsoft.eShopWeb.Infrastructure.Data;
{
public class EfRepository<T> : RepositoryBase<T>, IReadRepository<T>, IRepository<T> where T : class, IAggregateRoot public class EfRepository<T> : RepositoryBase<T>, IReadRepository<T>, IRepository<T> where T : class, IAggregateRoot
{ {
public EfRepository(CatalogContext dbContext) : base(dbContext) public EfRepository(CatalogContext dbContext) : base(dbContext)
{ {
} }
} }
}

View File

@@ -1,5 +1,5 @@
namespace Microsoft.eShopWeb.Infrastructure.Data namespace Microsoft.eShopWeb.Infrastructure.Data;
{
public class FileItem public class FileItem
{ {
public string FileName { get; set; } public string FileName { get; set; }
@@ -9,4 +9,3 @@
public string Type { get; set; } public string Type { get; set; }
public string DataBase64 { get; set; } public string DataBase64 { get; set; }
} }
}

View File

@@ -1,8 +1,8 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations;
{
public partial class InitialModel : Migration public partial class InitialModel : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@@ -204,4 +204,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
name: "catalog_type_hilo"); name: "catalog_type_hilo");
} }
} }
}

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations;
{
public partial class FixBuyerId : Migration public partial class FixBuyerId : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@@ -50,4 +50,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
oldMaxLength: 256); oldMaxLength: 256);
} }
} }
}

View File

@@ -2,8 +2,8 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
namespace Microsoft.eShopWeb.Infrastructure.Identity namespace Microsoft.eShopWeb.Infrastructure.Identity;
{
public class AppIdentityDbContext : IdentityDbContext<ApplicationUser> public class AppIdentityDbContext : IdentityDbContext<ApplicationUser>
{ {
public AppIdentityDbContext(DbContextOptions<AppIdentityDbContext> options) public AppIdentityDbContext(DbContextOptions<AppIdentityDbContext> options)
@@ -19,5 +19,3 @@ namespace Microsoft.eShopWeb.Infrastructure.Identity
// Add your customizations after calling base.OnModelCreating(builder); // Add your customizations after calling base.OnModelCreating(builder);
} }
} }
}

Some files were not shown because too many files have changed in this diff Show More