- 浏览: 475276 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (1028)
- [发布至博客园首页] (826)
- [随笔分类]个人生活随笔 (14)
- [网站分类]首页候选区 (26)
- [网站分类]SharePoint (15)
- [网站分类]其他技术区 (6)
- [随笔分类]批处理技巧 (6)
- [随笔分类].net 2.0 (3)
- [随笔分类]SharePoint2007(MOSS2007) (0)
- [网站分类].NET新手区 (6)
- [网站分类]ASP.NET (6)
- [网站分类]架构设计 (18)
- [网站分类]程序人生 (2)
- [网站分类]SQL Server (2)
- WCF (3)
- 编程技巧 (2)
- 模式架构 (2)
- 分析设计 (4)
- 生活随笔 (0)
- 软件工程 (1)
- Android实例 (2)
最新评论
-
zilong0536:
楼主您好:
请问发表博文支持图片的功能怎么实现啊,一直没有思路 ...
新浪微博开放平台开发-android客户端(3) -
nicegege:
小弟 学习了
帮助中国移动设计10086的排队小模块 -
zl7824516:
用什么技术没说啊
通告(公告),消息(站内短信),提醒的设计:通告 -
virusswb:
源码下载: SinaWeibo2 源码下载之后,将后缀改为ra ...
新浪微博开放平台开发-android客户端(3) -
Jimmyxu0311:
找不到源码下载
新浪微博开放平台开发-android客户端(3)
Silverlight3+WCF遇到的问题(二):wcf system.servicemodel.communicationexception
- 博客分类:
- [网站分类]首页候选区
以前我访问的数据库都是一张表,没有关联,昨天添加了两张表,一共两张表,用户表和用户类型表,然后修改了原来的两个实体类
用户信息实体类
代码
<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />-->using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Domain.Entity
{
[DataContract]
public class Customer : INotifyPropertyChanged
{
private int _intCustomerId;
private string _strCustomerName;
private string _strCustomerCode;
private CustomerType _CustomerType;
private int _intCustomerTypeId;
[DataMember ]
public virtual int CustomerTypeId
{
get { return _intCustomerTypeId; }
set
{
_intCustomerTypeId = value;
OnPropertyChanged("CustomerTypeId");
}
}
[DataMember ]
public virtual CustomerType CustomerType
{
get { return this._CustomerType; }
set
{
this._CustomerType = value;
OnPropertyChanged("CustomerType");
}
}
[DataMember]
public virtual int CustomerId
{
get { return this._intCustomerId; }
set
{
this._intCustomerId = value;
OnPropertyChanged("CustomerId");
}
}
[DataMember]
public virtual string CustomerName
{
get { return this._strCustomerName; }
set
{
this._strCustomerName = value;
OnPropertyChanged("CustomerName");
}
}
[DataMember]
public virtual string CustomerCode
{
get { return _strCustomerCode; }
set
{
this._strCustomerCode = value;
OnPropertyChanged("CustomerCode");
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Domain.Entity
{
[DataContract]
public class Customer : INotifyPropertyChanged
{
private int _intCustomerId;
private string _strCustomerName;
private string _strCustomerCode;
private CustomerType _CustomerType;
private int _intCustomerTypeId;
[DataMember ]
public virtual int CustomerTypeId
{
get { return _intCustomerTypeId; }
set
{
_intCustomerTypeId = value;
OnPropertyChanged("CustomerTypeId");
}
}
[DataMember ]
public virtual CustomerType CustomerType
{
get { return this._CustomerType; }
set
{
this._CustomerType = value;
OnPropertyChanged("CustomerType");
}
}
[DataMember]
public virtual int CustomerId
{
get { return this._intCustomerId; }
set
{
this._intCustomerId = value;
OnPropertyChanged("CustomerId");
}
}
[DataMember]
public virtual string CustomerName
{
get { return this._strCustomerName; }
set
{
this._strCustomerName = value;
OnPropertyChanged("CustomerName");
}
}
[DataMember]
public virtual string CustomerCode
{
get { return _strCustomerCode; }
set
{
this._strCustomerCode = value;
OnPropertyChanged("CustomerCode");
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
用户类型实体类
代码
<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />-->using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Domain.Entity
{
[DataContract]
public class CustomerType : INotifyPropertyChanged
{
private string _strCustomerTypeName;
private int _intCustomerTypeId;
private IList <Customer> _customers;
[DataMember ]
public virtual int CustomerTypeId
{
get { return this._intCustomerTypeId; }
set
{
this._intCustomerTypeId = value;
OnPropertyChanged("CustomerTypeId");
}
}
[DataMember]
public virtual string CustomerTypeName
{
get { return this._strCustomerTypeName; }
set
{
this._strCustomerTypeName = value; OnPropertyChanged("CustomerTypeName");
}
}
[DataMember]
public virtual IList<Customer> Customers
{
get { return this._customers; }
set
{
this._customers = value;
OnPropertyChanged("Customers");
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public override string ToString()
{
return CustomerTypeName;
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Domain.Entity
{
[DataContract]
public class CustomerType : INotifyPropertyChanged
{
private string _strCustomerTypeName;
private int _intCustomerTypeId;
private IList <Customer> _customers;
[DataMember ]
public virtual int CustomerTypeId
{
get { return this._intCustomerTypeId; }
set
{
this._intCustomerTypeId = value;
OnPropertyChanged("CustomerTypeId");
}
}
[DataMember]
public virtual string CustomerTypeName
{
get { return this._strCustomerTypeName; }
set
{
this._strCustomerTypeName = value; OnPropertyChanged("CustomerTypeName");
}
}
[DataMember]
public virtual IList<Customer> Customers
{
get { return this._customers; }
set
{
this._customers = value;
OnPropertyChanged("Customers");
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public override string ToString()
{
return CustomerTypeName;
}
}
}
请注意上面的这个红色部分IList,本来我是想返回集合的,一想针对接口编程,然后就写了一个IList,可是问题就出来了,原来好好的东西,就跑不了了,一个劲的报错。
在SL3客户端的代码
<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />-->void client_GetCustomerCompleted(object sender, GetCustomerCompletedEventArgs e)
{
LayoutRoot.DataContext = e.Result;
}
{
LayoutRoot.DataContext = e.Result;
}
报错,就在e.Result,报错wcf system.servicemodel.communicationexception 我就开始找啊找,google啊google,很多人提出这个错误,就是没有回答。后来我在这篇请教当返回自定义类型时如何通过<declaredTypes>实现序列化帖子中找到了一些提示信息,他说“查了一些帮助,发现是由于返回类型中有个IList,所以无法序列化”,恍然大悟,还是WCF版的版主Frank Xu Lei厉害啊,哈哈。
修改成List就可以了,问题解决。
发表评论
-
《深入浅出设计模式-中文版》读书笔记 策略模式(二)
2010-07-02 07:25 754接着上回的“针对接口编程,不针对实现编程”原则说。 假 ... -
《深入浅出设计模式-中文版》读书笔记 策略模式(二)
2010-07-02 07:25 702接着上回的“针对接口编程,不针对实现编程”原则说。 假 ... -
NET 应用架构指导 V2 学习笔记(十二) 业务逻辑层的设计步骤
2010-06-01 00:07 459部署方面的考虑 当部署业务逻辑层的时候,一定要考虑生产 ... -
NET 应用架构指导 V2 学习笔记(二十一) 设计业务实体
2010-06-08 07:05 436概况 业务实体 ... -
分页存储过程(五)在MS SQL Server中打造更加准确,且有一点效率提升的的分页结果
2010-06-08 08:38 530以前的分页我都是 ... -
NET 应用架构指导 V2 学习笔记(二十二) 设计数据访问组件
2010-06-09 06:53 409概况 数据层组 ... -
Silverlight3+WCF遇到的问题(一):调试资源字符串不可用。密钥和参数通常提供足够的信息用以诊断该问题
2010-01-21 10:48 1405我在windows2003 R2上面开发Silve ... -
Silverlight3系列(九)Silverlight 及其相关技术简介
2010-02-09 10:51 7301、Silverlight应用类型 •RIA Rich I ... -
【转载】利用SQL的charindex实现字符串数组和Split函数
2010-03-13 12:57 1082大家在T-SQL中使用substring的时候需要注意一点 ... -
根据总用量计算每种包装规格的购买量和总价
2010-03-23 12:36 446最近有这么一个需求,就是给出客户需要的总量,然后根据 ... -
根据总用量计算每种包装规格的购买量和总价
2010-03-23 12:36 257最近有这么一个需求,就是给出客户需要的总量,然后根据 ... -
Silverlight3+WCF遇到的问题(一):调试资源字符串不可用。密钥和参数通常提供足够的信息用以诊断该问题
2010-01-21 10:48 3237我在windows2003 R2上面开发Silve ... -
Silverlight3+WCF遇到的问题(二):wcf system.servicemodel.communicationexception
2010-01-28 13:43 702以前我访问的数据库都是一张表,没有关联,昨天添加了两张 ... -
Silverlight3系列(九)Silverlight 及其相关技术简介
2010-02-09 10:51 5841、Silverlight应用类型 •RIA Rich I ... -
【转载】利用SQL的charindex实现字符串数组和Split函数
2010-03-13 12:57 817大家在T-SQL中使用substring的时候需要注意一点 ... -
根据总用量计算每种包装规格的购买量和总价
2010-03-23 12:36 437最近有这么一个需求,就是给出客户需要的总量,然后根据 ... -
Silverlight3+WCF遇到的问题(一):调试资源字符串不可用。密钥和参数通常提供足够的信息用以诊断该问题
2010-01-21 10:48 2098我在windows2003 R2上面开发Silve ... -
Silverlight3+WCF遇到的问题(二):wcf system.servicemodel.communicationexception
2010-01-28 13:43 778以前我访问的数据库都是一张表,没有关联,昨天添加了两张 ... -
Silverlight3系列(九)Silverlight 及其相关技术简介
2010-02-09 10:51 6951、Silverlight应用类型 •RIA Rich I ... -
【转载】利用SQL的charindex实现字符串数组和Split函数
2010-03-13 12:57 944大家在T-SQL中使用substring的时候需要注意一点 ...
相关推荐
1 安装开发环境 操作系统:Windows 7 专业版 ... 银光套件:Silverlight.exe Silverlight4_Tools.exe Silverlight_Developer.exe ...3 建立一个vs2010+silverlight4+wcf的项目 为了少啰嗦,大家看图吧。
silverlight+Wcf实现登录silverlight+Wcf实现登录
在IIS6+FRAMEWORK4.0上部署SILVERLIGHT4+WCF应用程序[汇编].pdf
vs2010+Silverlight4+wcf开发部署全过程
silverlight+wcf仓库管理源码.rarsilverlight+wcf仓库管理源码.rarsilverlight+wcf仓库管理源码.rarsilverlight+wcf仓库管理源码.rar
IIS6+Framework4.0上部署Silverlight4+WCF应用程序 特殊用途
silverlight+wcf仓库管理系统源码 仓库源码 开发语言 : C# 数据库 : SQL2008 开发工具 : VS2010 源码类型 : WebForm 注意:不带技术支持,有帮助文件,虚拟商品,发货不退,看好再拍。 源码描述: silverlight +...
Silverlight+WCF配置具体方法 讲解
Silverlight + WCF 数据压缩源码和例子(看readme.txt)
在IIS上部署Silverlight+WCF项目教程。
NULL 博文链接:https://alecrichard009.iteye.com/blog/1266327
silverlight+wcf n维拼图游戏
silverlight+wcf+linq简单实例, 客户端用Silverlight通过wcf远程调用服务器数据库中数据,实现数据的添删改
自己写的一个silverlight+wcf+LinqToSql的demo,带数据库的.
Silverlight+WCF 员工管理系统
(silverlight +WCF +SQL)联合开发时,需要用的CODESIMTH 三层模板
silverlight+WCF上传文件、下载文件,下载可用
windows服务+WCF中间件 windows服务+WCF中间件 windows服务+WCF中间件 windows服务+WCF中间件 windows服务+WCF中间件 windows服务+WCF中间件 windows服务+WCF中间件
使用技术:IIS+ASP.NET+WCF+ORACLE+C# 打开方式:Visual Studio 2017以上版本,以管理员方式打开 软件说明:一个使用WCF制作的WEB服务器系统,用于支持驾驶员考试。 数据库结构在:HldWcfModel.HldSysTableClass.cs...
WCF--system.serviceModel配置属性说明[借鉴].pdf