Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Error on System.Linq.IQueryable - Join clause

Posted on by 1,320

Hi, I am getting the below errorr for the following code. I know it's an issue with the syntax but I can't figure out how to fix. I am learning c# and plugin development so any help would be appreciated.

            {
                CrmServiceContext crmService = new CrmServiceContext(((IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory))).CreateOrganizationService(new Guid?(val2.UserId)));
                var list = (from x in crmService.SalesOrderDetailSet.Join(
                    crmService.ProductSet, 
                    (SalesOrderDetail x) => x.ProductId.Id, 
                    (Product x) => x.Id, 
                    (SalesOrderDetail x, Product y) => new
                {
                    x,
                    y
                })
                    where x.x.SalesOrderId.Id == salesOrderReference.Id && x.y.ktl_ConsolidateintoServices.Value == true
                    select x).ToList();
                SalesOrder salesOrder = crmService.SalesOrderSet.First((SalesOrder x) => x.Id == salesOrderReference.Id);


Error 1: 'System.Linq.IQueryable<entity>' does not contain a definition for 'Join' and no extension method 'Join' accepting a first argument of type 'System.Linq.IQueryable<entity>' could be found (are you missing a using directive or an assembly reference?) 

Error 2: 'System.Linq.IQueryable<entity>' does not contain a definition for 'First' and no extension method 'First' accepting a first argument of type 'System.Linq.IQueryable<entity>' could be found (are you missing a using directive or an assembly reference?)

*This post is locked for comments

  • epark06 Profile Picture
    epark06 1,320 on at
    RE: Error on System.Linq.IQueryable - Join clause

    [quote user="Goutam Das"]

    Hi ,

    Could you please add reference-  System.Data.Entity;

    [/quote]

    Just tried that and still getting the same errors.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Error on System.Linq.IQueryable - Join clause

    Hi ,

    Could you please add reference-  System.Data.Entity;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans