File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Enyim.Caching/Configuration Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,26 @@ public MemcachedClientConfiguration(
133133 NodeLocator = options . Servers . Count > 1 ? typeof ( DefaultNodeLocator ) : typeof ( SingleNodeLocator ) ;
134134 }
135135
136- if ( transcoder != null )
136+ if ( ! string . IsNullOrEmpty ( options . Transcoder ) )
137+ {
138+ try
139+ {
140+ if ( options . Transcoder == "BinaryFormatterTranscoder" )
141+ options . Transcoder = "Enyim.Caching.Memcached.Transcoders.BinaryFormatterTranscoder" ;
142+
143+ var transcoderType = Type . GetType ( options . Transcoder ) ;
144+ if ( transcoderType != null )
145+ {
146+ Transcoder = Activator . CreateInstance ( transcoderType ) as ITranscoder ;
147+ _logger . LogDebug ( $ "Use '{ options . Transcoder } '") ;
148+ }
149+ }
150+ catch ( Exception ex )
151+ {
152+ _logger . LogError ( new EventId ( ) , ex , $ "Unable to load '{ options . Transcoder } '") ;
153+ }
154+ }
155+ else if ( transcoder != null )
137156 {
138157 this . _transcoder = transcoder ;
139158 _logger . LogDebug ( $ "Use Transcoder Type : '{ transcoder . ToString ( ) } '") ;
You can’t perform that action at this time.
0 commit comments