コード例 #1
0
        public void Apply(SupplierLocationIsCreated evt)
        {
            this.SupplierId = evt.SupplierId;

            this.Locations.Add(new SupplierLocation
            {
                SuplierlocationId = evt.SupplierLocationId,
                LocationName      = evt.Location
            });
        }
コード例 #2
0
        public void Handle(IViewContext context, SupplierLocationIsCreated domainEvent)
        {
            SupplierAggregateRoot supplier = context.TryLoad <SupplierAggregateRoot>(domainEvent.SupplierId.ToString());

            if (supplier == null)
            {
                throw new System.Exception($"Can not find Supplier by Id <{domainEvent.SupplierId}>");
            }

            this.SupplierId   = supplier.SupplierId;
            this.SupplierName = supplier.Name;

            this.SupplierLocationId = domainEvent.SupplierLocationId;
            this.LocationName       = domainEvent.Location;
        }