Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7570037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:19:03+00:00 2026-05-30T15:19:03+00:00

I have a database schema (MySql) exposed as a data/OData service that is queried

  • 0

I have a database schema (MySql) exposed as a data/OData service that is queried by my Silverlight client using Linq. Here is the model in question:
enter image description here

The columns Level and Application are Int values referencing via a foreign key the tables lookuplevel and lookuppid respectively.

So, an entry in the logstest table may look like this:

ID:35
Date: 2012-02-29
Level: 1
Application: 1
Message: MyMessage
Exception: MyException
ReverseOrder: 56 (don't mind this column)

And we could have in lookuplevel:

ID: 1
String: Warning

And in lookuppid

ID: 1
String: Product A

As you can see, the Level and Application columns are actually mapped to a value in there referenced table.

Now client side (Silverlight), I get the content of the logstest table via a linq query.

public void LoadErrors()
{
   var linqQuery = (from e in _myEntities.logstests
                    select e);

   AsyncCallback GetDataComplete = new AsyncCallback(MyCallback);
           ((DataServiceQuery<logstest>)linqQuery).BeginExecute(GetDataComplete, linqQuery);
}

private void MyCallback(IAsyncResult asyncResult)
{
    DataServiceQuery<logstest> query = asyncResult.AsyncState as DataServiceQuery<logstest>;

    foreach (logstest error in e.Query.EndExecute(e.Result))
    {
        Error newError = new Error
        {
            Date = error.Date,
            Level = error.lookuplevel.String,
            Application = error.lookuppid.String,
            Message = error.Message,
            Exception = error.Exception
        };
    }

    // Do more stuff...
}

Error is a custom class that is binded on a datagrid that displays each field in a separate column.

Obviously, for the columns Level and Application, I do not want to display the index of the value they reference but the value itself (ie: for Level I want to display Warning and not 1).

The problem is that both error.lookuplevel and error.lookuppid are null and I have no idea why.
Is there a gotcha somewhere that I don’t know about?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:19:05+00:00Added an answer on May 30, 2026 at 3:19 pm

    You must explicitely ask to include the related entity, otherwise WCF DS Client will not ask for it on the server. And it also doesn’t do lazy loading of the navigation properties, since the lazy load would have to invoke an HTTP request which can take a really long time, and so it’s not a good idea to do that inside a property getter.

    To ask to include related entities, you need to add $expand to the query, like this:

    var linqQuery = (from e in 
       _myEntities.logstests.Expand("lookuppid").Expand("lookuplevel")  
       select e); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have a query using the schema database in MySQL that
In my SQL Server database schema I have a data table with a date
I have a database schema in SQL 2005 that I want to copy to
I have a database schema that is similar to the following: | User |
Lets imagine I have the same database schema as here: http://www.databaseanswers.org/data_models/driving_school/index.htm If a customer
I have a web application that uses a relational database (MySQL). We're adding a
I have a SQL Server database with lots of data and an empty MySQL
I am using MySQL Workbench 5.2.28 for designing my database schema. I need to
I have a MySQL database that contains many tables, some of them created dynamically
I'm designing my database schema using MySQL Workbench, which is pretty cool because you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.