private ICollectionMapping GetCollectionMapping(Type type) { if (type.Namespace.StartsWith("Iesi.Collections") || type.Closes(typeof(HashSet<>))) return new SetMapping(); return new BagMapping(); }
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"); } }
public bool Matches(Type type) { return type.Closes(typeof(RestfulPatchRequest<>)); }
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<>)); }
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>(); }