New Posts New Posts RSS Feed: LINQ and Extended Entity Properties
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

LINQ and Extended Entity Properties

 Post Reply Post Reply
Author
rasmister View Drop Down
Newbie
Newbie


Joined: 03-Feb-2011
Posts: 1
Post Options Post Options   Quote rasmister Quote  Post ReplyReply Direct Link To This Post Topic: LINQ and Extended Entity Properties
    Posted: 03-Feb-2011 at 8:56am
Folks,

I have the following query that is throwing and exception:

private IEnumerable<INotifyCompleted> GetParticipantsByNameFullCoRoutine()
{
_isBatchCompleted = false;

Participants.Clear();
var participantOp =
App.EntityManager.Participants
//.Where(p => p.NameFullFirstLast == SearchTerm)
.ExecuteAsync();

yield return participantOp;

if (participantOp.Results.Count() > 0)
{
participantOp.Results.Where(p => p.NameFullFirstLast == SearchTerm).ForEach(Participants.Add);
}

yield return Coroutine.Return(participantOp.Results);
}

The p.NameFullFirstLast is a computed value in the entity buddy class.

The exception thrown is "NameFullFirstLast" is not supported in LINQ to Entities.  Only initializers, entity members, and entity navigation pies are supported.

Is there a way to do this or am I barking up the wrong tree?

Thanks!

Ross



Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 731
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 03-Feb-2011 at 4:53pm
Hi ramister,
 
I was not able to reproduce your issue here.
Here's my test case: (against NorthwindIB)
 
  var coop  = Coroutine.Start(LoadListEntitiesCoroutine);
    coop.Completed += (sender, args) => {
    // some code
  };
 
...
 
  private IEnumerable<INotifyCompleted> LoadListEntitiesCoroutine() {
  var employeesOp = _mgr.Employees.ExecuteAsync();
  yield return employeesOp;
  if (employeesOp.Results.Count() > 0) {
    employeesOp.Results.Where(c => c.FullName == "Andy Fuller").ToList().ForEach(_employees.Add);
  }
  yield return Coroutine.Return(employeesOp.Results);
}
 
...
 
List<Employee> _employees = new List<Employee>();
 
...
 
public partial class Employee : BaseClass {
  public string FullName {
    get { return FirstName + " " + LastName; }
  }
}
 
Is "NameFullFirstLast" a custom property? How is it being implemented? You might also check this thread at http://stackoverflow.com/questions/2241643/how-to-use-a-custom-property-in-a-linq-to-entities-query.
 
Also, I'm assuming you mean to add more async operations in your coroutine, right? (otherwhise, why not just populate your list in the callback of ExecuteAsync?)
 
Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down