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

Bugfix/missing attributes for dynamic proxy #269

Merged
merged 3 commits into from
Aug 3, 2021

Conversation

huoshan12345
Copy link
Collaborator

@huoshan12345 huoshan12345 commented Jul 28, 2021

  1. replicate attributes that are targeted on implementation type to proxy type in method ProxyGeneratorUtils.CreateClassProxyInternal, which is used in method ProxyGenerator.CreateClassProxy<T>()
  2. add tests for 2#
  3. fix typo CustomAttributeBuildeUtils -> CustomAttributeBuilderUtils
  4. typeof(IAspectValidator).Name -> nameof(IAspectValidator)

@huoshan12345 huoshan12345 linked an issue Jul 28, 2021 that may be closed by this pull request
@huoshan12345
Copy link
Collaborator Author

huoshan12345 commented Jul 28, 2021

Here is a related question:
Do we need to replicate attributes(targeted on type, property, method) from implementation type to proxy type that are created in ProxyGeneratorUtils.CreateInterfaceProxyInternal, which is used in ProxyGenerator.CreateClassProxy<TService, TImplementation>?

Currently,

  1. all the attributes from TService are replicated to proxy type.
  2. none of the attributes from TImplementation is replicated to proxy type.

Personally, I think we can follow the same logic as TService service = new TImplementation().
In other words,

  1. donot replicate any attributes from TService to proxy type, which should be inherited to proxy type.
  2. replicate all the attributes from TImplementation to proxy type.

@huoshan12345 huoshan12345 self-assigned this Jul 28, 2021
@liuhaoyang liuhaoyang merged commit a71e603 into master Aug 3, 2021
@liuhaoyang liuhaoyang deleted the bugfix/missing-attributes-for-dynamic-proxy branch October 9, 2023 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

自定义特性 Attribute 使用动态代理后 丢失
2 participants