internal MapperOptions TryGetMapperOptions(Type t, MappingSides side) { if (mapperOptionsCache == null) { return(null); } var key = new OptionsCacheKey { Type = t, Side = side }; MapperOptions options; if (!MapperOptionsCache.TryGetValue(key, out options)) { options = MapperOptionsCache .Where(kv => kv.Key.Type.IsAssignableFrom(key.Type) && kv.Key.Side == side) .Select(kv => kv.Value).FirstOrDefault(); if (options != null) { if (mapperOptionsCache.ContainsKey(key)) { mapperOptionsCache.AddOrUpdate(key, options, (k, v) => options); } } } return(options); }
internal void AddMapperOptions(Type t, MapperOptions options, MappingSides side) { var key = new OptionsCacheKey { Type = t, Side = side }; MapperOptionsCache[key] = options; }