示例#1
0
        protected override void When(object @event)
        {
            switch (@event)
            {
            case Events.ResourceRegistered e:
                Id            = new ResourceId(e.ResourceId);
                ResourceName  = new ResourceName(e.ResourceName);
                ResourceNo    = new ResourceNo(e.ResourceNo);
                ResourcePrice = new ResourcePrice(e.ResourcePrice);
                break;

            case Events.ResourceDeleted e:
                Id        = new ResourceId(e.ResourceId);
                IsDeleted = new IsDeleted(e.IsDeleted);
                break;

            case Events.ResourceNameUpdated e:
                Id           = new ResourceId(e.ResourceId);
                ResourceName = new ResourceName(e.ResourceName);
                break;

            case Events.ResourceNoUpdated e:
                Id         = new ResourceId(e.ResourceId);
                ResourceNo = new ResourceNo(e.ResourceNo);
                break;

            case Events.ResourcePriceUpdated e:
                Id            = new ResourceId(e.ResourceId);
                ResourcePrice = new ResourcePrice(e.ResourcePrice);
                break;
            }
        }
示例#2
0
 public void UpdateResourceNo(ResourceNo resourceNo)
 {
     Apply(new Events.ResourceNoUpdated
     {
         ResourceId = Id,
         ResourceNo = resourceNo
     });;
 }
示例#3
0
 public Resource(ResourceId resourceId, ResourceName resourceName, ResourceNo resourceNo, ResourcePrice resourcePrice)
 {
     Apply(new Events.ResourceRegistered
     {
         ResourceId    = resourceId,
         ResourceName  = resourceName,
         ResourceNo    = resourceNo,
         ResourcePrice = resourcePrice,
     });
 }