entity right join code example

Example 1: left join in entity framework 6.0

var query = from u in usergroups
            join p in UsergroupPrices on u.UsergroupID equals p.UsergroupID into gj
            from x in gj.DefaultIfEmpty()
            select new { 
                UsergroupID = u.UsergroupID,
                UsergroupName = u.UsergroupName,
                Price = (x == null ? String.Empty : x.Price) 
            };

Example 2: Entity Framework double join

public class SomeContext: DbContext
    {
        public SometContext(DbContextOptions<SomeContext> options) : base(options) { }

        public DbSet<SomeJoinTable> Relationships { get; set; }
        public DbSet<Author> Authors { get; set; }
        public DbSet<Books> Books { get; set; }


        public string GetTemplateMethods(string models)
        {
            var result = (from _relationships in Relationships
                join _books in Books on <left-hand comparator> equals <right-hand comparator>
                join _authors in Authors on _relationships.AuthorId equals _books.AuthorId

                select new
                {
                    AuthorName = _authors.MethodName,
                    AuthorId = _authors.AuthorId,
                    BookId = _books.BookId
                }).ToList();
            
            return JsonConvert.SerializeObject(result);
        }
    }