Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISerializer,IRedisDatabase Non-generic Enhance #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oTcom
Copy link
Contributor

@oTcom oTcom commented Sep 22, 2020

Hi@imperugo
Let me describe the usage scenario.

GetAsync (cachekey) The return type is JObject, JDocment..., I need to specify the value return type.

Use GetAsync(cachekey, typeof(MyClass)) to return the type I want,.

//Now I have to do this to get the specified type.

var redisVlue = await _redisCacheClient.Db0.Database.StringGetAsync(cacheKey);
cacheValue = redisVlue.HasValue ? JsonSerializer.Deserialize(redisVlue, returnType) : cacheValue;

The test code is used to illustrate the usage scenarios for enhancing this function.

Added IRedisDatabase Non Generic GetAsync overload method .
@oTcom
Copy link
Contributor Author

oTcom commented Sep 23, 2020

ubuntu-latest build failed, can you try again.

@imperugo
Copy link
Owner

imperugo commented Nov 9, 2020

Hi @oTcom
I don't understand the need.
GetAsync<object>(...) isn't enought?

@oTcom
Copy link
Contributor Author

oTcom commented Nov 9, 2020

Hi @imperugo
Thank you for coming back.

GetAsync<object>(...)

The return type is JObject, JDocment.
I can only get object types,So you cannot use generic methods.

@imperugo
Copy link
Owner

imperugo commented Nov 9, 2020

What about a Custom Serializer that doesn't return JObject instead of that? Morver why you prefer object instead of T?

@oTcom
Copy link
Contributor Author

oTcom commented Nov 9, 2020

I am using dynamic proxy method to intercept. In this scenario, only the type of the object can be obtained, and the specific T cannot be obtained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants