mirror of
https://github.com/farcasclaudiu/PracticeCalendar.git
synced 2026-06-28 15:01:06 +03:00
play with storing valueobjects
This commit is contained in:
+4
-4
@@ -1,12 +1,12 @@
|
||||
using Ardalis.GuardClauses;
|
||||
using PracticeCalendar.Domain.Common;
|
||||
|
||||
namespace PracticeCalendar.Domain.Entities
|
||||
namespace PracticeCalendar.Domain.Entities.PracticeEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Attendee to an event
|
||||
/// </summary>
|
||||
public class Attendee: EntityBase
|
||||
public class Attendee : EntityBase
|
||||
{
|
||||
public Attendee(string name, string emailAddress)
|
||||
{
|
||||
@@ -20,12 +20,12 @@ namespace PracticeCalendar.Domain.Entities
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string EmailAddress { get; set; } = string.Empty;
|
||||
public bool IsAttending { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set if the Attendee is attending
|
||||
/// </summary>
|
||||
/// <param name="isAttending"></param>
|
||||
public void SetIsAttending (bool isAttending)
|
||||
public void SetIsAttending(bool isAttending)
|
||||
{
|
||||
this.IsAttending = isAttending;
|
||||
//TODO - raise event
|
||||
+2
-2
@@ -4,7 +4,7 @@ using PracticeCalendar.Domain.Common.Interfaces;
|
||||
using PracticeCalendar.Domain.Events;
|
||||
using PracticeCalendar.Domain.Exceptions;
|
||||
|
||||
namespace PracticeCalendar.Domain.Entities
|
||||
namespace PracticeCalendar.Domain.Entities.PracticeEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Practice event aggregate
|
||||
@@ -22,7 +22,7 @@ namespace PracticeCalendar.Domain.Entities
|
||||
}
|
||||
|
||||
public string Title { get; private set; } = string.Empty;
|
||||
public string Description{ get; private set; } = string.Empty;
|
||||
public string Description { get; private set; } = string.Empty;
|
||||
|
||||
public IList<Attendee> Attendees { get; private set; } = new List<Attendee>();
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using Ardalis.Specification;
|
||||
|
||||
namespace PracticeCalendar.Domain.Entities.PracticeEvent.Specifications
|
||||
{
|
||||
public class PracticeEventByIdWithAttendeesSpecification : Specification<PracticeEvent>
|
||||
{
|
||||
public PracticeEventByIdWithAttendeesSpecification(int eventId)
|
||||
{
|
||||
Query.Where(x => x.Id == eventId)
|
||||
.Include(x => x.Attendees);
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using Ardalis.Specification;
|
||||
|
||||
namespace PracticeCalendar.Domain.Entities.PracticeEvent.Specifications
|
||||
{
|
||||
public class PracticeEventsWithAttendeesSpecification : Specification<PracticeEvent>
|
||||
{
|
||||
public PracticeEventsWithAttendeesSpecification()
|
||||
{
|
||||
Query.AsNoTracking()
|
||||
.Include(x => x.Attendees);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using PracticeCalendar.Domain.Common;
|
||||
using PracticeCalendar.Domain.Common.Interfaces;
|
||||
using PracticeCalendar.Domain.ValueObjects;
|
||||
|
||||
namespace PracticeCalendar.Domain.Entities.Product
|
||||
{
|
||||
public class Product : EntityBase, IAggregateRoot
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Category { get; set; } = string.Empty;
|
||||
public Price UnitPrice { get; set; } = Price.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Ardalis.Specification;
|
||||
|
||||
namespace PracticeCalendar.Domain.Entities.Product.Specifications
|
||||
{
|
||||
public class AllProductsSpecification : Specification<Product>
|
||||
{
|
||||
public AllProductsSpecification()
|
||||
{
|
||||
Query.AsNoTracking();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Ardalis.Specification;
|
||||
|
||||
namespace PracticeCalendar.Domain.Entities.Specifications
|
||||
{
|
||||
public class PracticeEventByIdWithAttendees : Specification<PracticeEvent>
|
||||
{
|
||||
public PracticeEventByIdWithAttendees(int eventId)
|
||||
{
|
||||
Query.Where(x=>x.Id == eventId)
|
||||
.Include(x => x.Attendees);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using Ardalis.Specification;
|
||||
|
||||
namespace PracticeCalendar.Domain.Entities.Specifications
|
||||
{
|
||||
public class PracticeEventsWithAttendees : Specification<PracticeEvent>
|
||||
{
|
||||
public PracticeEventsWithAttendees()
|
||||
{
|
||||
Query.AsNoTracking()
|
||||
.Include(x => x.Attendees);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user