none
Linq To Entities not returning Entities RRS feed

  • Question

  • Using a Linq to Entities query from a Prism module project to a Silverlight .Web project returns no Entities whether by an Invoke (code below) or a C# Linq to Entities query. What does work is a WCF Service with a Linq to Entities query and XAML data binding using a Linq to Entities query.

    Code:

    AccountsDomainContext ctx = new AccountsDomainContext();

    InvokeOperation c = (ctx.GetAccountsCount("A73W4"));

    CountTextBlock.Text = c.Value.ToString();

     

    Domain Service:

    [Invoke()] public int GetAccountsCount(string accountNumber)

    {

    AccountsEntities accountsContext = new AccountsEntities();

    return Convert.ToInt32 ((from account in accountsContext.Accounts where account.AccountNumber.Equals(accountNumber) select account).Count());

    }



    Friday, September 2, 2011 5:56 AM

Answers

All replies

  • Hi,

    Have you look at Profiler if your where condition is being executing or returning any data?

    Regards,

    JA Reyes.


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.
    • Edited by JA Reyes Friday, September 2, 2011 7:36 AM syntaxis
    Friday, September 2, 2011 7:02 AM
  • I've already changed the whole query to "return 42;" so its not a problem with the query returning any data.
    Friday, September 2, 2011 7:12 AM
  • Ok,

    Then take a look at this other thread in order to see if it can help you:

    http://forums.silverlight.net/p/223855/539176.aspx

    Best regards,

    JA Reyes.


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.
    • Marked as answer by Bifrost Design Friday, September 2, 2011 7:34 AM
    Friday, September 2, 2011 7:22 AM