了解列表与WCF中的domaindatasouirces [英] understanding lists vs domaindatasouirces in WCF

查看:75
本文介绍了了解列表与WCF中的domaindatasouirces的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对列表和域数据源之间的C#感到非常困惑.显然,来自在domainservice中执行的查询的数据在某处,但我想从理解在网络上发布的许多很棒的示例(跨越使用列表类中声明的简单数据的示例)到从domaindatasource中获取代码中的数据方面迈出一大步.

例子:

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:

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>



现在,我有了一个列表,我了解了它,并且可以通过许多方式和许多示例来遍历列表.


现在让我们说我在SQLServer中有一个国家/地区表,其数据完全相同.我可以轻松地用链接到我的SQL Server数据库中具有ID和字段CountryName的表的代码或XAML声明域数据源.我可以轻松地在代码中加载domaindatasource 相当多的内容,但是当我想将数据从domaindata源传递到列表中或在循环中迭代数据时,在有关该主题的任何文档中都找不到任何内容.

显然,列表或domaindatasource都可以绑定到XAML中的控件.我想了解如何获得上面的"Countries"之类的代码示例,如何将这些示例转换为使用数据库中的实际数据,这意味着使用domaindatasources.

有人可以指出我如何用代码将domaindatasource转换为列表或遍历domaindatasource中的数据的解释吗?

非常感谢,

拉里·弗里德曼(Larry Freedman)



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

推荐答案

力量

这篇关于了解列表与WCF中的domaindatasouirces的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆