Instantly share code, notes, and snippets.

@vkhorikov /1.cs
Last active May 10, 2018

Embed
What would you like to do?
Value Objects and Identity
public class PlanningTool
{
internal int Id { get; private set; }
// Rest of class
public ICollection<PlanningToolTab> Tabs { get; private set; }
}
public class PlanningToolTab
{
internal int Id { get; private set; }
public int PlanningToolId { get; private set; }
public int PlanningToolGroupId { get; private set; }
// Rest of class
public ICollection<PlanningToolGroup> Groups { get; private set; }
}
public class PlanningToolGroup
{
internal int Id { get; private set; }
// Rest of class
}
public class PlanningTool
{
internal int Id { get; private set; }
// Rest of class
public ICollection<PlanningToolTab> Tabs { get; private set; }
}
public class PlanningToolTab
{
public int PlanningToolId { get; private set; } // Part of the primary key
public int PlanningToolGroupId { get; private set; } // Part of the primary key
// Rest of class
public ICollection<PlanningToolGroup> Groups { get; private set; }
}
public class PlanningToolGroup
{
internal int Id { get; private set; }
// Rest of class
}
public class PlanningTool
{
internal PlanningToolId Id { get; private set; }
// Rest of class
public ICollection<PlanningToolTab> Tabs { get; private set; }
}
public class PlanningToolTab
{
public PlanningToolTabId Id { get; private set; }
// Rest of class
public ICollection<PlanningToolGroup> Groups { get; private set; }
}
public class PlanningToolGroup
{
internal PlanningToolGroupId Id { get; private set; }
// Rest of class
}
public class PlanningToolTabId : ValueObject
{
public PlanningToolId PlanningToolId { get; }
public PlanningToolGroupId PlanningToolGroupId { get; }
// Equality members
}
public class PlanningToolId : ValueObject
{
public int Value { get; }
// Equality members
}
public class PlanningToolGroupId : ValueObject
{
public int Value { get; }
// Equality members
}
public int PlanningToolId { get; private set; }
public PlanningTool PlanningTool { get; private set; }
// before
public int PlanningToolId { get; private set; }
public int PlanningToolGroupId { get; private set; }
// after
public PlanningTool PlanningTool { get; private set; }
public PlanningToolGroup PlanningToolGroup { get; private set; }
customer.Id = order.Id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment