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

  • Home
  • SEARCH
  • 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 6086461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:45:29+00:00 2026-05-23T11:45:29+00:00

I am working on a Silverlight application using a WCF service where I need

  • 0

I am working on a Silverlight application using a WCF service where I need to get all the Column Headers from a specific table. I have been trying to write a LINQ query to do this, but so far I have not been able to get it to work correctly. I have not found very much information pertaining to this. I have found the following information, but I have had difficulties connecting to my data.

http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/4856/#ReadAndPostComment

So far I have tried the following…This will not compile due to DataContext needing a parameter and that is where I am stuck.

public List<string> GetColumnHeaders()
{
    DataContext context = new DataContext();
    List<string> columnList = new List<string>();
    var dataModel = context.Mapping;

    foreach (var r in dataModel.GetTables())
    {
        if (r.TableName.Equals("table1", StringComparison.InvariantCultureIgnoreCase))
        {
            foreach (var c in r.RowType.DataMembers)
            {
                columnList.Add(c.MappedName);
            }
        }
    }
    return columnList;
}

Instead of using DataContext context = new DataContext();
I tried the following, but I know the problem is the same.

var dataModel = new AttributeMappingSource()
                 .GetModel(
                      typeof(RepositoryBase<HBS_SondesEntities>
                 ));
  • 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-23T11:45:30+00:00Added an answer on May 23, 2026 at 11:45 am

    Here is my best attempt at a solution, its hard to really understand what you have tried/written.

    public List<string> GetColumnHeaders(){
      List<string> columnList = new List<string>();
      using (SondesEntities context = new HBS_SondesEntities()){
        foreach (var r in context.Mapping.GetTables()){
           if (r.TableName
                 .Equals("table1", StringComparison.InvariantCultureIgnoreCase)) {
    
               foreach (var c in r.RowType.DataMembers){
                   columnList.Add(c.MappedName);
               }
           }
         }
      }
      return columnList;
    }
    

    Assuming I didn’t fat finger something here is the same code using linq.

    public List<string> GetColumnHeaders(){
    
        List<string> columnList = new List<string>();
        using (SondesEntities context = new HBS_SondesEntities()){
            var query = (
               context.Mapping.GetTables()
                 .Where(t=>t.TableName
                            .Equals(
                             "table1", 
                              StringComparison.InvariantCultureIgnoreCase)
                            )
                 ).SelectMany(x=>x.RowType.DataMembers);
    
            columnList  = query.Select(m=>m.MappedName).ToList()
        }
        return columnList;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application with a Silverlight-enabled WCF service. The service passes along
I have a silverlight 2 beta 2 application that accesses a WCF web service.
I am trying to call a WCF service from a Silverlight client using channel
I am currently working on an application that allows reverse geocoding using silverlight +
I'm working on a Silverlight application that works with WCF services. While loading the
I am trying to get out of browser support working for my Silverlight application
I am currently working on a silverlight business application, so I have come across
I have a functioning Silverlight 4 application (VS2010, SL4, WCF RIA, hosted on my
I'm working on a Silverlight application and I have a hard time setting the
all. I have a problem with uploading of the file in Silverlight application. Here

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.