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

Can't apply the library while using reflection emit with dynamic linq #411

Closed
KhoiNguyenICT opened this issue Aug 19, 2020 · 10 comments
Closed
Assignees

Comments

@KhoiNguyenICT
Copy link

Hi!
Today, i use reflection emit for generate dynamic entity for entityframework.
But library cannot support type IQueryable for dynamic query
Can you give me a solution for this problem!
Thank you so much!

@JonathanMagnan JonathanMagnan self-assigned this Aug 19, 2020
@JonathanMagnan
Copy link
Member

Hello @KhoiNguyenICT ,

Could you provide a full example of what you would want to do.

It will help my developer to get started with your request as I'm not fully sure to understand it.

Best Regards,

Jon


Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval FunctionSQL Eval Function

@KhoiNguyenICT
Copy link
Author

image
Hi @JonathanMagnan
This is example for my issue
In the line 132 to line 134 i try build dynamic entity from my setting
But in the line 135 i use dynamic linq for find item, but library not support query with IQueryable
This is class for job build dynamic type use reflection emit: Link
Thanks @JonathanMagnan

@JonathanMagnan
Copy link
Member

Hello @KhoiNguyenICT ,

If you wish we try to find a solution, we will need a full runnable project that contains the minimum code to reproduce it.

@KhoiNguyenICT
Copy link
Author

Hi @JonathanMagnan
This is example for use refection emit: Link https://github.com/giangcoi48k/test-assembly-emit
Thanks @JonathanMagnan

@JonathanMagnan
Copy link
Member

Hello @KhoiNguyenICT ,

I tried a few examples with System.Linq.Dynamic.Core and Z.Expressions.Eval library and both are working as expected.

_dbContext.Add(obj);
_dbContext.SaveChanges();

var set = _dbContext.Set(type);
//var q2 = set.Where("Name == \"test\"");
//var q2 = set.WhereDynamic("x => x.Name == 'test'");
var q3 = set.SingleOrDefaultDynamic("x => x.Name == 'test'");
return Ok(_dbContext.Set(type));

Both libraries support IQueryable, so I'm not really sure how to reproduce this issue.

@JonathanMagnan
Copy link
Member

Hello @KhoiNguyenICT

Since our last conversation, we haven't heard from you.

As mentioned in my previous message, both libraries support IQueryable.

Don't hesitate to provide further information, so that we can help you better.

Best regards,

Jon

@KhoiNguyenICT
Copy link
Author

@JonathanMagnan
Thank you so much
I tryed for this. Expression had good for template

var record = _context.Set(type).SingleOrDefaultDynamic($"x => x.Id.Equals(@Id)", new { Id = id });

@KhoiNguyenICT
Copy link
Author

KhoiNguyenICT commented Aug 24, 2020

@JonathanMagnan
But I have not figured out how to re-initialize runtime Type of ModuleBuilder when DefineType was successful before. Do you have any ideas for this problem?.
Thanks!

@JonathanMagnan
Copy link
Member

Sorry @KhoiNguyenICT , I do not understand what you want.

@KhoiNguyenICT
Copy link
Author

@JonathanMagnan
My problem has been solved.
Thank you so much!

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

No branches or pull requests

2 participants