question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SubQuery - The method or operation is not implemented.

See original GitHub issue

I have such a query, which works OK if I don’t use string concatenation in the anonymous object Customer, if I add l.FullName + “C” I get an exception saying “The method or operation is not implemented.”

            var q = from se in _dataContext.ScheduleEvent
                where se.Start.HasValue && se.Start.Value.Date == request.Date.Date
                from seas in _dataContext.ScheduleEventAttendees
                where seas.ScheduleEvent_Id == se.Id
                from sea in _dataContext.ScheduleEventAttendee
                where sea.Id == seas.ScheduleEventAttendee_Id
                from sepNull in (from sep in _dataContext.ScheduleEventProperties
                    where sep.ScheduleEvent_id == se.Id && (sep.Name == Scheduler.PropEventJobId || sep.Name == Scheduler.PropEventLeadId)
                    select sep).DefaultIfEmpty()
                from appTypeNull in (from appType in _dataContext.ScheduleEventAppointmentTypeHistory
                    where appType.ScheduleEvent_Id == se.Id
                          && appType.Id == (from appTypeMax in _dataContext.ScheduleEventAppointmentTypeHistory
                              where appTypeMax.ScheduleEvent_Id == se.Id
                              select appTypeMax.Id).Max()
                    select appType).DefaultIfEmpty()
                from jobTypeNull in (from sep in _dataContext.ScheduleEventProperties
                    where sep.ScheduleEvent_id == se.Id && (sep.Name == Scheduler.PropEventJobId || sep.Name == Scheduler.PropEventLeadId)
                    select new
                    {
                        JobId = sep.IntValue,
                        JobIdType = sep.Name == Scheduler.PropEventJobId ? JobQuoteJobIdType.JobQuote : JobQuoteJobIdType.Lead
                    }).DefaultIfEmpty()
                from fabNull in (from sep in _dataContext.ScheduleEventProperties
                    where sep.ScheduleEvent_id == se.Id && (sep.Name == Scheduler.PropEventJobId || sep.Name == Scheduler.PropEventLeadId)
                    select new
                    {
                        Fabricator = sep.Name == Scheduler.PropEventJobId
                            ? (from j in _dataContext.ClientJob
                                where j.Id == sep.IntValue
                                from quote in _dataContext.Quote
                                where quote.ClientJob_id == j.Id
                                from cb in _dataContext.CustomerBase
                                where cb.Id == (from quoteBid in _dataContext.QuoteBid
                                          where quoteBid.Quote_id == quote.Id
                                          select quoteBid.Fabricator_id).FirstOrDefault()
                                select new
                                {
                                    Id = cb.Id,
                                    Name = cb.Name,
                                    Email = cb.ContactEmail,
                                    Phone = cb.CanonicalPhone,
                                    Address = cb.Address1,
                                    Zip = cb.Postal
                                }).FirstOrDefault()
                            : (from l in _dataContext.Lead
                                where l.Id == sep.IntValue
                                from cb in _dataContext.CustomerBase
                                where cb.Id == l.Fabricator_Id
                                select new
                                {
                                    Id = cb.Id,
                                    Name = cb.Name,
                                    Email = l.Email,
                                    Phone = l.Phone,
                                    Address = l.FullAddress,
                                    Zip = l.Zip
                                }).FirstOrDefault()
                    }).DefaultIfEmpty()
                from custNull in (from sep in _dataContext.ScheduleEventProperties
                    where sep.ScheduleEvent_id == se.Id && (sep.Name == Scheduler.PropEventJobId || sep.Name == Scheduler.PropEventLeadId)
                    select new
                    {
                        Customer = sep.Name == Scheduler.PropEventJobId
                            ? (from j in _dataContext.ClientJob
                                where j.Id == sep.IntValue
                                from cb in _dataContext.CustomerBase
                                where cb.Id == j.Client_id
                                select new
                                {
                                    Id = cb.Id,
                                    Name = cb.Name,
                                    Email = cb.ContactEmail,
                                    Phone = cb.CanonicalPhone,
                                    Address = cb.Address1,
                                    Zip = cb.Postal
                                }).FirstOrDefault()
                            : (from l in _dataContext.Lead
                                where l.Id == sep.IntValue
                                select new
                                {
                                    Id = l.Id,
                                    Name = l.FullName + "C",
                                    Email = l.Email,
                                    Phone = l.Phone,
                                    Address = l.FullAddress,
                                    Zip = l.Zip
                                }).FirstOrDefault()
                    }).DefaultIfEmpty()


                select new
                {
                    Attendee = new
                    {
                        sea.Id,
                        sea.DisplayName,
                        sea.Email
                    },
                    Schedule = new
                    {
                        se.Id,
                        se.Start,
                        se.End,
                        se.Summary,
                        se.Fabricator_Id,
                        LastAppointmentType = appTypeNull == null ? (AppointmentType?) null : appTypeNull.AppointmentType
                    },
                    LastStatus = sepNull != null
                        ? GetLastJobQuoteStatusLogEntry(sepNull.IntValue.Value, sepNull.Name == Scheduler.PropEventJobId ? JobQuoteJobIdType.JobQuote : JobQuoteJobIdType.Lead)
                        : null,
                    JobInfo = jobTypeNull,
                    Fabricator = fabNull,
                    Customer = custNull
                };

Very un-expected error without any explanation.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
sdanylivcommented, Dec 13, 2016

@integral-llc, attach your generated DataContext file. Maybe i can find time to look here more closer.

0reactions
sdanylivcommented, Feb 2, 2017

@ili, fix is obvious, but i don’t understand this code and why exception was throwed. Here is simplified test that reproduces error:

[Test]
public void Test()
{
   using (var db = new NorthwindDB())
   {
      var q2 = from sep in db.Orders
         select new
         {
            Customer =
            (from l in db.OrderDetails
               select new
               {
                  UnitPrice = l.UnitPrice + 1
               }).FirstOrDefault()
         };

      var str = q2.ToString();
   }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Query returns "The method or operation is not implemented ...
From what I gather the Accept() method is involved in query optimisation. It looks like the functionality is incomplete. Unfortunately there ...
Read more >
70722: ' The method or operation is not implemented. ...
inside a subquery that are to be "fused" with an outer query. Suggested fix: implement this method by simply calling the visitor's accept...
Read more >
Subqueries (SQL Server)
Because they must return a single value, subqueries introduced by an unmodified comparison operator (one not followed by the keyword ANY or ALL...
Read more >
Query not supported in DirectQuery mode - SQL with subquery
Solved: I am attempting to organize data from a SQL server by removing rows which contain duplicates in a certain column. When using...
Read more >
Correlated subqueries - Amazon Redshift
Correlation references from within a subquery that contains a window function. select listid, qtysold from sales s where qtysold not in (select sum(numtickets) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found