public bool TryGetContext(long typeId, out ConverterContext context) { if (contexts.TryGetValue(typeId, out context)) { return(true); } context = null; return(false); }
public bool TryGetContext(Type type, out ConverterContext context) { if (contextTypes.TryGetValue(type, out var typeId)) { if (contexts.TryGetValue(typeId, out context)) { return(true); } } context = null; return(false); }
public virtual void AddContext(ConverterContext converterContext, Type type, long typeId) { contextTypes[type] = typeId; contexts[typeId] = converterContext; }
public virtual void AddContext <T>(ConverterContext converterContext, long typeId) { AddContext(converterContext, typeof(T), typeId); }