我有 Person 聚合,它是根聚合
public class Person
{
private int id;
private readonly PersonID personID;
private readonly string email;
private readonly string firstName;
private readonly string lastName;
private readonly string username;
private readonly string password;
private readonly Address BillingAddress;
}
public class Currency : IValueObject<Currency>
{
private string name;
private string currencyCode;
private decimal rate;
private string displayLocale;
private string customFormatting;
private int displayOrder;
private bool primaryExchangeRateCurrency;
private bool primaryStoreCurrency;
//<summary>
//Gets or a value indicating whether the currency is primary exchange rate currency
//</summary>
public bool IsPrimaryExchangeRateCurrency
{
get
{
return primaryExchangeRateCurrency;
}
}
/// <summary>
/// Gets or a value indicating whether the currency is primary store currency
/// </summary>
public bool IsPrimaryStoreCurrency
{
get
{
return primaryStoreCurrency;
}
}
}
和 Currency 类,将在 Person 类中引用。
所以现在如果创建了一个 Person 实体,我们也需要将它与货币相关联。但是在所有创建的货币中,我想知道哪个是默认的主要商店货币。我不想通过 Person 知道它,因为它只包含单一货币。我想从所有创建的人的货币中获得一种货币,即 PrimaryStoreCurrency。
我想在下拉列表中绑定货币,以便用户可以从下拉列表中选择其货币并在我们的系统中注册。
那么,我是否将货币创建为单独的聚合?