Sharepoint2010 对象模型(6)

2018-11-19 20:23

查看原图(大图)

同时,还会修改web.config文件如下

查看原图(大图)

【注意】这些属于是WCF最基本的知识,如果你对此不清楚,可以参考我有关其他的文章,例如你可以在我的博客中搜索WCF关键字

http://www.google.com.hk/custom?domains=cnblogs.com&q=site:www.cnblogs.com/chenxizhang/+wcf&sitesearch=cnblogs.com&client=pub-4210569241504288&forid=1&channel=5875741252&ie=UTF-8&oe=UTF-8&safe=active&cof=GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:129;L:http://images.cnblogs.com/logo_small.gif;S:http://www.cnblogs.com/;FORID:1&hl=zh-CN

4. 修改该服务,使其具有一个方法,可以获取员工列表

首先修改服务契约

using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text;

namespace SilverlightApplication6.Web { // NOTE: You can use the \ command on the \ menu to change the interface name \ in both code and config file together. [ServiceContract] public interface IEmployeeService { [OperationContract] void DoWork();

[OperationContract] Employee[] GetEmployees();

}

[DataContract] public class Employee { [DataMember] public string FirstName { get; set; } [DataMember] public string LastName { get; set; } } } 然后修改服务定义

using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text;

namespace SilverlightApplication6.Web { // NOTE: You can use the \ command on the \ menu to change the class name \ in code, svc and config file together. public class EmployeeService : IEmployeeService { public void DoWork() { }

public Employee[] GetEmployees() { return new Employee[]{ new Employee(){FirstName=\ };

} } } 【注意】目前我们只是做演示,还没有读取SharePoint

5. 测试该服务,选中svc文件,然后右键,在浏览器中查看


Sharepoint2010 对象模型(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2015-2016第二学期PS期中

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: