简体   繁体   English

使用asp.net Web服务在客户端和服务器上使用相同的DTO库

[英]Use same DTO library on client and server with asp.net webservices

Hello I have a (silverlight) class library containing plain DTO classes. 您好,我有一个(silverlight)类库,其中包含纯DTO类。
For this example "Person". 对于此示例“人”。

I have a ASP.NET Webservice (.asmx) that returns a List of Person. 我有一个返回人员列表的ASP.NET Web服务(.asmx)。

Now on the consuming side (silverlight) I want to generate a client stub for the webservice. 现在,在使用方(silverlight),我想为Web服务生成一个客户端存根。
This works ok, however, it generates a NEW Person class for me.. 可以,但是,它为我生成了一个NEW Person类。
I want to reuse my existing DTO person class. 我想重用我现有的DTO人员类。

I tried to use Advanced->reuse types in referenced assemblies but until now to no avail.... 我试图在引用的程序集中使用Advanced-> reuse类型,但是直到现在都没有用。

Can anybody help me with this ? 有人可以帮我吗?

You won't be able to do this because Silverlight and .NET, while similar, use completely different runtimes and assemblies. 您将无法执行此操作,因为尽管Silverlight和.NET相似,但它们使用完全不同的运行时和程序集。 An assembly that is compiled for Silverlight cannot be used with the .NET CLR and vice-versa. 为Silverlight编译的程序集不能与.NET CLR一起使用,反之亦然。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM