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

Improve code generation performance/caching using open generic types #448

Open
arashjfz opened this issue Jun 25, 2019 · 7 comments
Open

Comments

@arashjfz
Copy link

It is very useful that open generic types can be supported

@stakx
Copy link
Member

stakx commented Jun 25, 2019

Hi @arashjfz, can you describe one or more use cases why this would be a useful feature?

(Implementing it would probably mean a lot of work, so—regardless of who would be implementing this—without having a clear incentive, it most likely isn't going to happen.)

@arashjfz
Copy link
Author

arashjfz commented Jun 26, 2019

Ok let met describe you a situation
I am developing a framework like out system. We use nhibernate as ORM.
for some reason we want to proxy the ISession and generic IQueryOver
there are two solution to proxy the generic IQueryOver
first one is to make type for all entities like IQueryOver'Employee' and etc. As you see this is not an efficient solution.Because if we have 1000 entities in our application we need 1000 dynamic type that override generic IQueryOver
second one is to proxy the generic IQueryOver but in the format of open generic

As you know stakx this behavior of generic type is the main different between Java and .net

@stakx
Copy link
Member

stakx commented Jun 27, 2019

If I understand you correctly, this would be mostly an optimization, then? You're not blocked from proxying the types you need to proxy--but you wish that DynamicProxy would be more efficient by making use of the CLR's "code sharing" for generic type instantiations?

@arashjfz
Copy link
Author

yes exactly it is a performance problem

@jonorossi jonorossi changed the title Is there any chance to supporting for open generic Types Improve code generation performance/caching using open generic types Jul 15, 2019
@arashjfz
Copy link
Author

@stakx I am really interested in this issue. If it is possible I can give it a try

@stakx
Copy link
Member

stakx commented Sep 25, 2019

@arashjfz: Sure, it cannot hurt if you look into it and have a go at it. We do welcome contributions!

A word of warning (not to discourage you up-front, but so you know what to expect), this might be non-trivial and amount to a fair bit of work. I for one don't expect to be able to provide much guidance (among other things, due to my current workload at work).

Perhaps @jonorossi can let you know if and how this will fit with the planned release schedule.

@jonorossi
Copy link
Member

@arashjfz go for it, contributions are definitely welcome. I should have time to answer specific questions, but like @stakx won't be able to dig in. Feel free to hack away at a prototype and submit a draft pull request for review. We can talk about releasing it when we've got something we all like.

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

No branches or pull requests

3 participants