public override bool IsMatch(Type type, OpenTypeMatchContext context) { return(type != typeof(IConnectionMultiplexer) && type != typeof(IDatabase) && type != typeof(string) && (!type.IsGenericType || type.GetGenericTypeDefinition() != typeof(IAsyncCollector <>))); }
public void OpenTypeContext() { var ctx = new OpenTypeMatchContext(); var ot = OpenType.FromType(typeof(OpenType)); var otArray = OpenType.FromType(typeof(OpenType[])); Assert.True(ot.IsMatch(typeof(string), ctx)); Assert.False(ot.IsMatch(typeof(string[]), ctx)); Assert.True(otArray.IsMatch(typeof(string[]), ctx)); Assert.True(ot.IsMatch(typeof(DateTime))); // We could match DateTime normally Assert.False(ot.IsMatch(typeof(DateTime), ctx)); // false because we already commited to 'string' within this context }
public override bool IsMatch(Type type, OpenTypeMatchContext context) { if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IEnumerable <>)) { return(false); } if (type.FullName == "System.Object") { return(true); } return(base.IsMatch(type, context)); }
public override bool IsMatch(Type type, OpenTypeMatchContext context) { return(type != typeof(byte[]) && type != typeof(IElasticMessage)); }
public override bool IsMatch(Type type, OpenTypeMatchContext ctx) { bool match = _types.Contains(type); return(match); }
public override bool IsMatch(Type type, OpenTypeMatchContext context) { return(!type.IsArray); }
public override bool IsMatch(Type type, OpenTypeMatchContext context) { return(ThrowIfInvalidItemType(true, type)); }
// Predicate is invoked by ConverterManager to determine if a type matches. public override bool IsMatch(Type t, OpenTypeMatchContext context) { return(t == typeof(string)); }
public bool IsMatch(Type source, Type dest, Type typeAttribute) { var ctx = new OpenTypeMatchContext(); return(this.IsMatchAttribute(typeAttribute) && this.Source.IsMatch(source, ctx) && this.Dest.IsMatch(dest, ctx)); }