Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var sql = new Sql()
.Select("*")
.From<Movie>(dbContext.SqlSyntax)
.Where<Movie>(m => m.Title == "Avatar", dbContext.SqlSyntax);
var avatar = dbContext.Database.Fetch<Movie>(sql).FirstOrDefault();
sql = new Sql()
.Select("Actors.*")
.From<Actor>(dbContext.SqlSyntax)
.InnerJoin<ActorMovie>(dbContext.SqlSyntax)
.On<ActorMovie, Actor>(dbContext.SqlSyntax, am => am.ActorId, ac => ac.Id)
.Where<ActorMovie>(am => am.MovieId == a.Id, dbContext.SqlSyntax);
avatar.Actors = dbContext.Database.Fetch<Actor>(sql);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.