开发者

When using Aggregate objects do you use custom collections for the associations or not?

开发者 https://www.devze.com 2022-12-09 19:35 出处:网络
For example is it better to have: public class Case : EntityIdentifiable { public Jobs Jobs { get; set; }

For example is it better to have:

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

    public IDistances Distances { get; set; }
}

or

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

I know that I could have an IDictionary there instead as well, but I had thou开发者_如何学Pythonght this would be bit troublesome when persisting stuff. Or maybe I am just too tired of everything being abstract and allchanging all the time and want at least some fixed points somewhere.

At present I am not thinking forward enough to know if there will be much of functionality in the collection classes, but there may be a bit.

I also need to bear in mind that I plan to use NHibernate to store my objects.

What would you do ?


Use the simpler solution. If you discover later that you need more, refactor it.

0

精彩评论

暂无评论...
验证码 换一张
取 消