private ICollectionMapping GetCollectionMapping(Type type)
        {
            if (type.Namespace.StartsWith("Iesi.Collections") || type.Closes(typeof(HashSet<>)))
                return new SetMapping();

            return new BagMapping();
        }
Exemplo n.º 2
0
 public WrapWithHandlerAttribute(Type handlerType)
 {
     if (handlerType.Closes(typeof (IHandler<>)))
     {
         HandlerType = handlerType;
     }
     else
     {
         throw new ArgumentException("Type is not a handler.", "handlerType");
     }
 }
        public static Type RuleTypeFor(Type inputType, Type attributeType)
        {
            if (attributeType.CanBeCastTo<IAuthorizationPolicy>()) return attributeType;

            if (attributeType.Closes(typeof(IAuthorizationRule<>)))
            {
                return typeof(AuthorizationPolicy<,>).MakeGenericType(inputType, attributeType);
            }

            throw new ArgumentOutOfRangeException("attributeType", "attributeType must implement either IAuthorizationPolicy or IAuthorizationRule<> for the input type");
        }
 public WrapWithConditionalAttribute(Type conditionType)
 {
     if (conditionType.Closes(typeof(ICondition<>)))
     {
         ConditionType = conditionType;
     }
     else
     {
         throw new ArgumentException("Type is not a condition.", "conditionType");
     }
 }
Exemplo n.º 5
0
 public bool Matches(Type type)
 {
     return type.Closes(typeof(RestfulPatchRequest<>));
 }
Exemplo n.º 6
0
        private static bool typeMatches(Type type)
        {
            if (type.IsGenericEnumerable()) return true;

            return type.Closes(typeof(IReadOnlyList<>));
        }
 public static bool IsSagaHandler(Type handlerType)
 {
     return handlerType.Closes(typeof (IStatefulSaga<>));
 }
 public bool Matches(Type type)
 {
     return type.Closes(typeof (List<>));
 }
Exemplo n.º 9
0
        public void Add(Type readerType)
        {
            if (!readerType.Closes(typeof (IReader<>)))
            {
                throw new ArgumentOutOfRangeException("readerType", "readerType must close IReader<T> where T is the input type for this chain");
            }

            var reader = readerType.CloseAndBuildAs<IReader>(_inputType);
            _readers.Add(reader);
        }
        public static bool IsLoaderTypeCandidate(Type type)
        {
            if (!type.IsConcreteWithDefaultCtor()) return false;

            if (type.Closes(typeof (IApplicationSource<,>))) return true;

            return type.CanBeCastTo<IApplicationLoader>();
        }