Marking value objects as "owned" explicitly

This commit is contained in:
Eric Fleming
2019-08-24 19:39:38 -04:00
parent 954df47b4a
commit 3165791d82
3 changed files with 6 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="1.2.9" /> <PackageReference Include="Ardalis.GuardClauses" Version="1.2.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="2.2.6" />
<PackageReference Include="System.Security.Claims" Version="4.3.0" /> <PackageReference Include="System.Security.Claims" Version="4.3.0" />
</ItemGroup> </ItemGroup>

View File

@@ -1,7 +1,9 @@
using System; using Microsoft.EntityFrameworkCore;
using System;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate
{ {
[Owned]
public class Address // ValueObject public class Address // ValueObject
{ {
public String Street { get; private set; } public String Street { get; private set; }

View File

@@ -1,4 +1,5 @@
using Ardalis.GuardClauses; using Ardalis.GuardClauses;
using Microsoft.EntityFrameworkCore;
namespace Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate 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 /// 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.
/// </summary> /// </summary>
[Owned]
public class CatalogItemOrdered // ValueObject public class CatalogItemOrdered // ValueObject
{ {
public CatalogItemOrdered(int catalogItemId, string productName, string pictureUri) public CatalogItemOrdered(int catalogItemId, string productName, string pictureUri)