Browse Source

Marking value objects as "owned" explicitly

main
Eric Fleming 6 years ago
parent
commit
3165791d82
  1. 1
      src/ApplicationCore/ApplicationCore.csproj
  2. 4
      src/ApplicationCore/Entities/OrderAggregate/Address.cs
  3. 2
      src/ApplicationCore/Entities/OrderAggregate/CatalogItemOrdered.cs

1
src/ApplicationCore/ApplicationCore.csproj

@ -7,6 +7,7 @@
<ItemGroup>
<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" />
</ItemGroup>

4
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; }

2
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.
/// </summary>
[Owned]
public class CatalogItemOrdered // ValueObject
{
public CatalogItemOrdered(int catalogItemId, string productName, string pictureUri)

Loading…
Cancel
Save