Silverlight ASP.NET MVC RESTful方法

时间:2021-09-10 15:26:56

I use Silverlight 3 with ASP.NET MVC. For database operations I query SQL Server database using FOR XML, and send the data as XML over wire to Silverlight client where it is deserialized to business object. Is this approach good? I do not find much resource on Internet about using Silverlight, ASP.NET and XML together.

我将Silverlight 3与ASP.NET MVC一起使用。对于数据库操作,我使用FOR XML查询SQL Server数据库,并将数据作为XML通过网络发送到Silverlight客户端,然后将其反序列化为业务对象。这种做法好吗?我在互联网上找不到关于一起使用Silverlight,ASP.NET和XML的资源。

1 个解决方案

#1


1  

Why not use a SOA approach? I'll first tell you my approach then a link under that for a direct ASP.NET MVC approach. My approach is only because I need to expose a web service to other devices.

为什么不使用SOA方法?我将首先告诉你我的方法然后是一个直接ASP.NET MVC方法的链接。我的方法仅仅是因为我需要将Web服务公开给其他设备。

I have a WCF library which acts as the DAL and some Business Logic. I then have my asp.net reference this dll. Nothing in the Model's folder. So the ASP.NET works the same.

我有一个WCF库,它充当DAL和一些业务逻辑。然后我有我的asp.net引用这个DLL。 Model的文件夹中没有任何内容。因此ASP.NET的工作方式相同。

For the silverlight, I use a service reference to the wcf service. Some features which uses the same data as the asp.net does, calls into the ASP.NET controller that is specified as how Tim Huer did it here.

对于silverlight,我使用wcf服务的服务引用。一些使用与asp.net相同数据的功能,调用ASP.NET控制器,这个控制器指定为Tim Huer在这里做的。

#1


1  

Why not use a SOA approach? I'll first tell you my approach then a link under that for a direct ASP.NET MVC approach. My approach is only because I need to expose a web service to other devices.

为什么不使用SOA方法?我将首先告诉你我的方法然后是一个直接ASP.NET MVC方法的链接。我的方法仅仅是因为我需要将Web服务公开给其他设备。

I have a WCF library which acts as the DAL and some Business Logic. I then have my asp.net reference this dll. Nothing in the Model's folder. So the ASP.NET works the same.

我有一个WCF库,它充当DAL和一些业务逻辑。然后我有我的asp.net引用这个DLL。 Model的文件夹中没有任何内容。因此ASP.NET的工作方式相同。

For the silverlight, I use a service reference to the wcf service. Some features which uses the same data as the asp.net does, calls into the ASP.NET controller that is specified as how Tim Huer did it here.

对于silverlight,我使用wcf服务的服务引用。一些使用与asp.net相同数据的功能,调用ASP.NET控制器,这个控制器指定为Tim Huer在这里做的。