public ConventionTypeCache(Type genericType, IConventionTypeCacheFactory <TValue> typeFactory) { if (genericType == null) { throw new ArgumentNullException(nameof(genericType)); } if (typeFactory == null) { throw new ArgumentNullException(nameof(typeFactory)); } var typeInfo = genericType.GetTypeInfo(); if (typeInfo.GenericTypeParameters == null) { throw new ArgumentException("The type specified must be a generic type", nameof(genericType)); } if (typeInfo.GenericTypeParameters.Length != 1) { throw new ArgumentException("The generic type must have a single generic argument", nameof(genericType)); } if (!typeof(TValue).IsAssignableFrom(genericType)) { throw new ArgumentException("The generic type must be assignable to T", nameof(genericType)); } _dictionary = new ConcurrentDictionary <Type, Cached>(); _typeFactory = typeFactory; }
public ConventionTypeCache(IConventionTypeCacheFactory <TValue> typeFactory, IInitializerConvention convention) { _typeFactory = typeFactory ?? throw new ArgumentNullException(nameof(typeFactory)); _convention = convention; _dictionary = new ConcurrentDictionary <Type, Cached>(); }
public MessageInitializerConvention(IConventionTypeCacheFactory <IMessageTypeInitializerConvention <TMessage> > cacheFactory) { _typeCache = new ConventionTypeCache <IMessageTypeInitializerConvention <TMessage> >(cacheFactory); }
protected InitializerConvention(IConventionTypeCacheFactory <IMessageInputInitializerConvention <TMessage> > cacheFactory, IInitializerConvention convention) { _typeCache = new ConventionTypeCache <IMessageInputInitializerConvention <TMessage> >(cacheFactory, convention); }