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
Newbie question: How on earth can I use this?? #95
Comments
You don't have to use var query = ctx.SomeTable.Where(...); After (this is the main part) query = query.ToLinqToDB(); Query is fully switched to alternative parser. After this call control over query execution is taken by |
Ok! Got it and works. Nice job. I like it especially because I am using an existing database. I'm 'abusing' ef core to create a middle layer with mainly Poco's being used in services. I have to move 900 stored procedures away from SQL server to a middle layer and make it independent from SQL server. Need to check however how to deal with the missing change-tracking. Did not pay attention to that subject yet, just took it out of the box. Noticed also that it is not good to mix using Microsoft.EntityFrameworkCore; with using LinqToDB.EntityFrameworkCore in one class. All .ToListAsync() and .AsnoTracking() used in ef core LinqSql error off. Apparently have to choose one or the other. Cheers! Herman |
Having said all of this, it looks like I cannot turn off tracking now! When using only LinqToDB to extract a list of clients, it tracks every entity! I have created a little test project here: https://github.com/hwmaat/Linq2DbEftest Any clue how to stop the change tracking? |
Have you tried |
LinqToDBForEFTools.EnableChangeTracker = false works, that would be a solution. It turns it off for all . AsNoTracking() does not exist on Ling2Db.EntityFrameworkCore. (from what I checked) I could not find a way to turn off change tracking just for the following query:
|
|
That is correct. BUT IF I add this to the code example above like: Don't know what the solution would be? |
Use |
OK! thanks a lot! also for the amazingly quick response. |
URW, closing then. I hope our extension will save your time as it does for others, |
I have a .netcore 5.0 web api project. Mysql database on the backend with Entity framework core.
Ran into your Linq2db. And I would love to be able to use the extensions like CTE, Left join etc....
The description tells me: 'is an integration of LINQ To DB with existing EntityFrameworkCore projects'
And I have an exsiting EntityFrameworkCore project.
And furthermore:
'In your code you need to initialize integration using following call:
LinqToDBForEFTools.Initialize();
After that you can just call DbContext and IQueryable extension methods, provided by LINQ To DB.'
The questions:
Where would I put the 'LinqToDBForEFTools.Initialize();' ? In the startup.cs in configure or configure services?
And how would I use it in my existing services? If I try to use e.g. LeftJoin, I can add using Linq2db etc. But the it just invalidates all existing code in that service.
It would be nice if you could give an example project with a simple backend like SQLite!
Thanks
The text was updated successfully, but these errors were encountered: