【问题标题】:When using Aggregate objects do you use custom collections for the associations or not?使用 Aggregate 对象时,您是否对关联使用自定义集合?
【发布时间】:2009-10-23 11:11:42
【问题描述】:

例如,最好有:

public class Case : EntityIdentifiable
{
    public Jobs Jobs { get; set; }
    public Vehicles Vehicles { get; set; }
    public Locations Locations {get;set;}

    public IDistances Distances { get; set; }
}

public class Case : EntityIdentifiable
{
    public Dictionary<string,Job> { get; set; }
    public Dictionary<string,Vehicle> { get; set; }
    public Dictionary<string,Location> {get;set;}

    public IDistances Distances { get; set; }
}

我知道我也可以在那里有一个 IDictionary,但我认为在持久化内容时这会有点麻烦。或者也许我只是太厌倦了一切都是抽象的,一直在变化,并且想要在某个地方至少有一些固定的点。

目前我的想法还不够远,无法知道集合类中是否会有很多功能,但可能会有一些。

我还需要记住,我计划使用 NHibernate 来存储我的对象。

你会怎么做?

【问题讨论】:

    标签: java .net domain-driven-design aggregate aggregators


    【解决方案1】:

    使用更简单的解决方案。如果您以后发现需要更多,请重构它。

    【讨论】:

    • 哪种方案更简单?
    猜你喜欢
    • 1970-01-01
    • 2011-03-14
    • 1970-01-01
    • 1970-01-01
    • 2010-10-11
    • 1970-01-01
    • 1970-01-01
    • 2021-11-26
    • 1970-01-01
    相关资源
    最近更新 更多