Silverlight 和 DataContractSurrogates 中都存在该类型 [英] silverlight The type exists in both and DataContractSurrogates
问题描述
我正在使用带有 ria 服务的 Silverlight 4 ..
我收到一个错误说:
I'm using silverlight 4 with ria serivces ..
I got an error said :
eLab.Web.SessionsHWFile"类型存在于eLab.Web.dll"和DataContractSurrogates_c96b3601-cd13-4049-93bb-e7b3f59a4fd9"中
The type 'eLab.Web.SessionsHWFile' exists in both 'eLab.Web.dll' and 'DataContractSurrogates_c96b3601-cd13-4049-93bb-e7b3f59a4fd9'
其中 eLab.Web 是托管 Silverlight 项目的 aspx Web 项目,SessionsHWFile 是 edmx 实体,它不是 DB 中的真实表,而是 VIEW.我从数据源中拖出一个网格并将其添加到 XAML 用户控件中,并使用查询从 DB 中的存储过程获取数据,但是在调试代码并展开结果视图时出现上述错误:
(来源:0zz0.com)子>
where eLab.Web is the aspx web project that hosts the silverlight project, and SessionsHWFile is an edmx entity ,it's not a real table in DB, it's VIEW. I dragged a grid from the data source and doped it in XAML user control, and used a query to get the data from stored procedure in DB, but I'm getting the above error when I debug the code and expand the results view :
(source: 0zz0.com)
我这样做了,添加了一个视图并从 DB 中的 SP 获取结果,就像一百万次一样,直到这次什么也没发生..
I did this ,adding a view and getting the results from SP in DB, like a million time and nothing happened until this time ..
推荐答案
**我想我知道问题是..
我发现您不能用相同的名称命名两个riaControls:DomainDataSource",即使它们是不同的 xaml 页面.
**I think I knew were the problem is ..
I discovered that you can't name two "riaControls:DomainDataSource" with the same Name, even if they're int different xaml pages.
老实说,我还不知道为什么,但这就是我解决问题的方法..
Honestly I don't know why yet, but that's how I fixed the problem ..
只需更改riaControls:DomainDataSource"的 Name 属性...**
Just change the Name property of the "riaControls:DomainDataSource" ...**
这篇关于Silverlight 和 DataContractSurrogates 中都存在该类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!