From 3165791d82604351fb25db0c0f2d3eed1de65c69 Mon Sep 17 00:00:00 2001 From: Eric Fleming Date: Sat, 24 Aug 2019 19:39:38 -0400 Subject: [PATCH] Marking value objects as "owned" explicitly --- src/ApplicationCore/ApplicationCore.csproj | 1 + src/ApplicationCore/Entities/OrderAggregate/Address.cs | 4 +++- .../Entities/OrderAggregate/CatalogItemOrdered.cs | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ApplicationCore/ApplicationCore.csproj b/src/ApplicationCore/ApplicationCore.csproj index 57861cb..0253059 100644 --- a/src/ApplicationCore/ApplicationCore.csproj +++ b/src/ApplicationCore/ApplicationCore.csproj @@ -7,6 +7,7 @@ + diff --git a/src/ApplicationCore/Entities/OrderAggregate/Address.cs b/src/ApplicationCore/Entities/OrderAggregate/Address.cs index 1c9fd64..8b5ed5f 100644 --- a/src/ApplicationCore/Entities/OrderAggregate/Address.cs +++ b/src/ApplicationCore/Entities/OrderAggregate/Address.cs @@ -1,7 +1,9 @@ -using System; +using Microsoft.EntityFrameworkCore; +using System; namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate { + [Owned] public class Address // ValueObject { public String Street { get; private set; } diff --git a/src/ApplicationCore/Entities/OrderAggregate/CatalogItemOrdered.cs b/src/ApplicationCore/Entities/OrderAggregate/CatalogItemOrdered.cs index 8daed9f..2adfe11 100644 --- a/src/ApplicationCore/Entities/OrderAggregate/CatalogItemOrdered.cs +++ b/src/ApplicationCore/Entities/OrderAggregate/CatalogItemOrdered.cs @@ -1,4 +1,5 @@ using Ardalis.GuardClauses; +using Microsoft.EntityFrameworkCore; namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate { @@ -6,6 +7,7 @@ namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate /// 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. /// + [Owned] public class CatalogItemOrdered // ValueObject { public CatalogItemOrdered(int catalogItemId, string productName, string pictureUri)