nathan-parkinson / linq2db.include Goto Github PK
View Code? Open in Web Editor NEWlinq2db.include adds Entity Framework style Include (eager loading) to linq2db
License: MIT License
linq2db.include adds Entity Framework style Include (eager loading) to linq2db
License: MIT License
Need to allow for predicate to be null as there is currently nullreferenceexception at PropertyQueryBuilder lines 219 and 221
When using a simple one-to-many association as follows:
[Association(ThisKey = nameof(Id), OtherKey = nameof(Child.ParentId))]
public List<Child> Children { get; set; } = new List<Child>();
All is well. Changing this to IEnumerable causes a System.InvalidOperationException: 'This operation is only valid on generic types.
[Association(ThisKey = nameof(Id), OtherKey = nameof(Child.ParentId))]
public IEnumerable<Child> Children { get; set; } = new List<Child>();
IList and ICollection also work correctly, so I assume the problem is co-variance of IEnumerable.
System.InvalidCastException.
trying to cast TParent, TProperty to TRoot, TProperty
Hi, I have an error System.MissingMethodException: Method not found: 'LinqToDB.Async.IAsyncEnumerable1<!!0> LinqToDB.Async.IQueryProviderAsync.ExecuteAsync(System.Linq.Expressions.Expression)'. at LinqToDB.Include.IncludeExtensions.ToIncludableQueryable[TClass](IQueryable1 query)
Using .NET 5, Linq2Db.EntityFrameworkCore 7.2.0
This is code
var commentsHierarchyCteAns = _commentsLinq2DbContext.GetCte<Comment>(commentHierarchy =>
{
return _commentsLinq2DbContext.GetTable<Comment>()
.Concat
(
from c in _commentsLinq2DbContext.GetTable<Comment>()
from c2 in commentHierarchy.InnerJoin(eh => c.Id == eh.ParentId)
select c
);
});
var commentsHierarchyCteDes = _commentsLinq2DbContext.GetCte<Comment>(commentHierarchy =>
{
return _commentsLinq2DbContext.GetTable<Comment>()
.Concat
(
from c in _commentsLinq2DbContext.GetTable<Comment>()
from c2 in commentHierarchy.InnerJoin(eh => c.ParentId == eh.Id)
select c
);
});
var result = commentsHierarchyCteAns.Union(commentsHierarchyCteDes);
var resultList = result.Include(c => c.Files).ToList();
Are you using left join syntax, multiple results-sets or multiple separate commands to fetch the related entities?
First, Single and ElementAt all ignore the Include setup and only run the main query
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.