Beispiel #1
0
        protected override object ResolveCommandTarget(ICommandMessage msg, object parent, PropertyInfo field, IEntityModel childEntityModel)
        {
            var commandHandlerRoutingKeys = ExtractCommandHandlerRoutingKeys(field, childEntityModel);

            var routingValue = commandHandlerRoutingKeys.GetValueOrDefault(msg.CommandName).GetValue <object>(msg.Payload);
            var enumerable   = (IEnumerable)field.GetValue(parent);

            return(enumerable
                   .Cast <object>()
                   .FirstOrDefault(i => Equals(routingValue, childEntityModel.GetIdentifier(i))));
        }
Beispiel #2
0
        private bool MatchesInstance <E>(E candidate, object routingValue)
        {
            var identifier = _childEntity.GetIdentifier(candidate);

            return(Equals(routingValue, identifier));
        }