我有这样的 CQRS 命令
public sealed class RequestRoute
{
public RequestRoute(string fromAddressName, double fromLatitude, double fromLongitude, string toAddressName, double toLatitude, double toLongitude, string userId)
{
UserId = userId;
ToLongitude = toLongitude;
ToLatitude = toLatitude;
ToAddressName = toAddressName;
FromLongitude = fromLongitude;
FromLatitude = fromLatitude;
FromAddressName = fromAddressName;
}
public string FromAddressName { get; private set; }
public double FromLatitude { get; private set; }
public double FromLongitude { get; private set; }
public string ToAddressName { get; private set; }
public double ToLatitude { get; private set; }
public double ToLongitude { get; private set; }
public string UserId { get; private set; }
}
我的程序员的直觉告诉我,我应该将 FromXXX 和 ToXXX 字段分解到一个名为“Address”的单独类中......但我不确定这是否违反了 CQRS 模式......我见过的所有例子都只使用原始类型作为命令和事件的属性。