@@ -475,7 +475,15 @@ TResult GetValue()
475475 {
476476 var type = model . GetType ( ) ;
477477 var cacheKey = ( $ "Lambda-Get-{ type . GetUniqueTypeName ( ) } ", typeof ( TModel ) , fieldName , typeof ( TResult ) ) ;
478- var invoker = Instance . GetOrCreate ( cacheKey , entry => LambdaExtensions . GetPropertyValueLambda < TModel , TResult > ( model , fieldName ) . Compile ( ) ) ;
478+ var invoker = Instance . GetOrCreate ( cacheKey , entry =>
479+ {
480+ if ( type . Assembly . IsDynamic )
481+ {
482+ entry . SetAbsoluteExpiration ( TimeSpan . FromSeconds ( 10 ) ) ;
483+ }
484+
485+ return LambdaExtensions . GetPropertyValueLambda < TModel , TResult > ( model , fieldName ) . Compile ( ) ;
486+ } ) ;
479487 return invoker ( model ) ;
480488 }
481489 }
@@ -492,15 +500,17 @@ public static void SetPropertyValue<TModel, TValue>(TModel model, string fieldNa
492500 d . SetValue ( fieldName , value ) ;
493501 }
494502 else
495- {
496- SetValue ( ) ;
497- }
498-
499- void SetValue ( )
500503 {
501504 var type = model . GetType ( ) ;
502505 var cacheKey = ( $ "Lambda-Set-{ type . GetUniqueTypeName ( ) } ", typeof ( TModel ) , fieldName , typeof ( TValue ) ) ;
503- var invoker = Instance . GetOrCreate ( cacheKey , entry => LambdaExtensions . SetPropertyValueLambda < TModel , TValue > ( model , fieldName ) . Compile ( ) ) ;
506+ var invoker = Instance . GetOrCreate ( cacheKey , entry =>
507+ {
508+ if ( type . Assembly . IsDynamic )
509+ {
510+ entry . SetAbsoluteExpiration ( TimeSpan . FromSeconds ( 10 ) ) ;
511+ }
512+ return LambdaExtensions . SetPropertyValueLambda < TModel , TValue > ( model , fieldName ) . Compile ( ) ;
513+ } ) ;
504514 invoker ( model , value ) ;
505515 }
506516 }
0 commit comments