Silverlight 4 uses domain service for fast data access

Source: Internet
Author: User
Tags web hosting to domain visual studio 2010
ArticleDirectory
    • Development Tools
    • Add a Silverlight Vulnerability
    • Add a new LINQ to SQL classes
    • New Domain Service
    • Silverlight access domain service
    • Domain service implementation method
    •  
    • Additional information

Before Silverlight 4, you must upload Web Services at the backend to allow Silverlight calls. Select, update, delete, and insert may require four methods, the minimum number of methods required for accessing 10 tables is 40. Although Ajax is the same, jquery can also be used, however, there is no such thing as Silverlight clients (third parties on November 8), which seems to be suffering.

Silverlight 4 is better than external. It is a new domain service technology license that can automatically generate WCF web services to access the table or entity pulled out by using the LINQ or Entity Framework tool, there are also self-generated proxies in the Silverlight proposal case, and there is still no need to manage the proxy, no need to update the web services as before, but also need to manually update the web hosting test, it saves a lot of effort.

 

Development Tools

Silverlight 4 micro-platform does not have a tool for developing Silverlight for Visual Studio 2008. It can only be developed using Visual Studio 2010 and blend 4, but when vs2010 went public (mid April, silverlight 4 tools is still in beta (the official version was released in early June). Therefore, Silverlight 4 is not built in vs2010 and must be installed

Microsoft Silverlight 4 tools for Visual Studio 2010

In Silverlight 4 tools, only Entity Framework to domain service tools are available. You must install

WCF Ria services Toolkit

 

Add a Silverlight Vulnerability

When a Silverlight application is added, the new Silverlight Applicaion dialog box is displayed. Enable WCF Ria services must be checked to automatically generate the WCF proxy.

If you forget to check the content, you can also select the web application program in the Silverlight program case (only the web application program case can be selected because Web services is required ).

 

Add a new LINQ to SQL classes

When there is no information, you can use the adventureworks2008r2 in Microsoft SQL Server community projects & samples as an example, then pull a table.

It is very important to build it. Otherwise, the domain service cannot find the final information.

At the beginning, I didn't know. I found this problem only one or two hours ago, and I was killed.

 

New Domain Service

Domain service is classified under the web.

Some settings are as follows: the DataGrid's own Chinese subject or website certificate provides information and other medium-level information, which will generate an external casePartial classMethod added.

In fact, the domain service class is only refined to produce the code for the survival of LINQ. If the model has been modified after the event, the domain service class will be re-generated only in the case of hacking, but I have read some articles and said that they are used.Partial classTwo tokens are generated by the user and added by the user. The code added by the user is not generated when the user is deleted.

 

Silverlight access domain service

In this case, we can see the self-generated code.

The Code merge method is similar to the General compile method of LINQ, but it is not synchronous and must use load to obtain information.

What is better than traditional WCF is that it sends queries to retrieve data, which is more efficient than traditional.

 

Domain service implementation method

It is also a web service, and is only self-generated.

Add an httpmodules in Web. config, which is treated as domain service class +. SVC.

For example, silverlightria. Web. domainservice1 will convert. Into-plus. SVC, such as SilverlightRIA-Web-DomainService1.svc

In the Silverlight case, the relationship and code are automatically generated.

How to setup your domainservice using partial classes for easy maintenance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.