Refactor to introduce nullable types and reduce compiler warnings (#801)
* Introduce nullable types to Core, Infrastructure and PublicApi projects * Refactor unit tests * Fixed failing tests * Introduce Parameter object for CatalogItem update method * Refactor CataloItemDetails param object * Refactor following PR comments
This commit is contained in:
committed by
GitHub
parent
aa6305eab1
commit
a72dd775ee
@@ -8,9 +8,8 @@ namespace Microsoft.eShopWeb.Infrastructure.Data;
|
||||
|
||||
public class CatalogContext : DbContext
|
||||
{
|
||||
public CatalogContext(DbContextOptions<CatalogContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
#pragma warning disable CS8618 // Required by Entity Framework
|
||||
public CatalogContext(DbContextOptions<CatalogContext> options) : base(options) {}
|
||||
|
||||
public DbSet<Basket> Baskets { get; set; }
|
||||
public DbSet<CatalogItem> CatalogItems { get; set; }
|
||||
|
||||
@@ -9,7 +9,7 @@ public class BasketConfiguration : IEntityTypeConfiguration<Basket>
|
||||
public void Configure(EntityTypeBuilder<Basket> builder)
|
||||
{
|
||||
var navigation = builder.Metadata.FindNavigation(nameof(Basket.Items));
|
||||
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
||||
navigation?.SetPropertyAccessMode(PropertyAccessMode.Field);
|
||||
|
||||
builder.Property(b => b.BuyerId)
|
||||
.IsRequired()
|
||||
|
||||
@@ -10,7 +10,7 @@ public class OrderConfiguration : IEntityTypeConfiguration<Order>
|
||||
{
|
||||
var navigation = builder.Metadata.FindNavigation(nameof(Order.OrderItems));
|
||||
|
||||
navigation.SetPropertyAccessMode(PropertyAccessMode.Field);
|
||||
navigation?.SetPropertyAccessMode(PropertyAccessMode.Field);
|
||||
|
||||
builder.Property(b => b.BuyerId)
|
||||
.IsRequired()
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
public class FileItem
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string? FileName { get; set; }
|
||||
public string? Url { get; set; }
|
||||
public long Size { get; set; }
|
||||
public string Ext { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string DataBase64 { get; set; }
|
||||
public string? Ext { get; set; }
|
||||
public string? Type { get; set; }
|
||||
public string? DataBase64 { get; set; }
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>Microsoft.eShopWeb.Infrastructure</RootNamespace>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user