Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am very confused in C# between lists and domain data sources. Clearly the data from a query executed in the domainservice is somewhere but I am just to thick to make the leap from understanding the many wonderful examples posted on the web that use simple data declared in list classes to getting data in code out of a domaindatasource.

An example:

C#
public class Country
   {
     public int Id { get; set; }
     public string CountryName { get; set; }
   }
  public class CountryLookup
   {
    public CountryLookup()
    {
      this.Countries = new List<Country>()
      {
        new Country() { Id = 0, CountryName = "England" },
        new Country() { Id = 1, CountryName = "Scotland" },
        new Country() { Id = 2, CountryName = "Wales" },
        new Country() { Id = 3, CountryName = "Northern Ireland" }
      };
    }
    public List<country> Countries { get; private set; }
  }</country>


Now I have a list and I understand it and can iterate through the list in many ways and lots of examples.


Now lets say I have a country table in SQLServer with the exact same data. I can easily declare a domain data source in code or in XAML linked to the table in my SQL Server database which has an ID and a field CountryName. I can load the domaindatasource quite easily in code but when I want to pass the data to a list from the domaindata source or iterate the data in a loop I find nothing in any documentation on the subject.

Clearly either a list or a domaindatasource can be bound to controls in XAML. I would like to understand how when I get code examples like the "Countries" above how to transalte those examples into using real data from databases and that means using domaindatasources.

Can someone point me to an explanation of how to turn a domaindatasource into a list or iterate through the data in a domaindatasource in code?

Many thanks,

Larry Freedman
Posted
Updated 7-Jul-10 3:47am
v2

1 solution

This might help.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900