接口文件“IService”:namespace _11.LINQtoSQL.Web
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        List<Product> GetChartData();
    }
}问题一:“ServiceContract”是什么???他的作用是什么???问题二:“OperationContract”是什么???他的作用是什么???

解决方案 »

  1.   

    http://xyztony1985.blog.163.com/blog/static/36117820090592128676/
    http://topic.csdn.net/u/20110412/13/3137206e-9ad3-4c39-b152-21f9a82d7da6.html
      

  2.   

    这是WCF定义契约时候的标签。
    [ServiceContract] 标识的接口会被WCF暴露给外部以供调用。
    [OperationContract] 用来标记暴露给外部的方法。
      

  3.   


    对吭,WCF的契约,暴露出的方法。WebService有没有这类型的契约呢???
      

  4.   

    WebService的标签是 <WebService>
      

  5.   


    应该用WebService还是WCF呢???
      

  6.   

    WCF 包含 WebService,WebService 在.net 4.0已经没有Project Template了。比如你用 WCF 的 wsHttpBinding, basicHttpBinding 这两种绑定时,其实就是 WebService 了。
      

  7.   


    在WCF中服务一般都定义接口的,这样有利于管理和维护的对吧?关于WCF中的“DataTable”等业务逻辑关系处理可以使用“DLL”文件进行封装吗,可以封装在“三层”里面吗???