static Func <object, bool> BuildFilter(string filter, ActorType type)
        {
            if (filter == null)
            {
                var prototype = ActorPrototype.Of(type);
                return(item => prototype.DeclaresHandlerFor(item.GetType()));
            }

            if (filter == "*")
            {
                return(item => true);
            }

            if (!filter.EndsWith("()"))
            {
                throw new InvalidOperationException("Filter string value is missing '()' function designator");
            }

            var method = GetStaticMethod(filter, type.Implementation);

            if (method == null)
            {
                throw new InvalidOperationException("Filter function should be a static method");
            }

            return((Func <object, bool>)method.CreateDelegate(typeof(Func <object, bool>)));
        }
Exemple #2
0
 internal static StreamSubscriptionSpecification From(ActorType actor, StreamSubscriptionAttribute attribute)
 {
     return(From(actor, ActorPrototype.Of(actor), attribute));
 }
Exemple #3
0
 internal static IEnumerable <StreamSubscriptionSpecification> From(ActorType actor)
 {
     return(From(actor, ActorPrototype.Of(actor)));
 }