コード例 #1
0
        public Store(Guid id, StoreGroup storeGroup, string name) : base(id)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            GroupId = storeGroup?.Id;
            Name    = name.Trim();
        }
コード例 #2
0
        public void AttachToGroup(StoreGroup storeGroup)
        {
            if (storeGroup == null)
            {
                throw new ArgumentNullException(
                          paramName: nameof(storeGroup),
                          message: $"The store group cannot be null. Please use {nameof(DetachFromGroup)} if you want to detach this store from its current group."
                          );
            }

            if (storeGroup.Id != GroupId)
            {
                AddEvent(new StoreGroupChanged(this, storeGroup));
            }
        }