OrmLiteValidationSource can not work well when using redisCache because of Json Deserialize #108
-
        the fix a way is isssue code  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            mythz
          
      
      
        Feb 8, 2024 
      
    
    Replies: 1 comment 12 replies
-
| 
         Use  services.AddSingleton<IValidationSource>(c => {
    var cache = c.GetRequiredService<MemoryCacheClient>();
    return new OrmLiteValidationSource(c.GetRequiredService<IDbConnectionFactory>(), cache, TimeSpan.FromMinutes(5));
}); | 
  
Beta Was this translation helpful? Give feedback.
                  
                    12 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
It's for locally cached validation rules that rarely change, I'd recommend avoiding the the unnecessary I/O.