Sometimes the examples aimed at demonstrating a given feature or technology have to be simple and canonical; sometimes not. This is one of the cases in which a more realistic example helps to reveal the potential of the underlying...
See more »
Sometimes the examples aimed at demonstrating a given feature or technology have to be simple and canonical; sometimes not. This is one of the cases in which a more realistic example helps to reveal the potential of the underlying framework and determine the best way of using its features. Let's start with a little data access layer built around some of the tables of the SQL Server™ Northwind database. As shown in Figure 1, I created a CoreDataService class with a few methods that are thin wrappers around queries. As you can see, most of the methods return an ADO.NET DataTable object. To build a sample Atlas application, I used the Atlas Visual Studio® 2005 template installed with the latest community technology preview (CTP). Figure 2 shows the markup of the page, not including script. The page contains a couple of dropdown list controls, one for choosing a year and one for selecting the employee name. An HTML button completes the user interface. Note that the button control doesn't have to be a standard tag because, in this case, a submit input field is all that's required. Clicking on a submit button is handled by the browser and resolved through a traditional postback; in order to use out-of-band calls, a client-side button is required along with a bit of JavaScript. In Atlas, you have two ways to define remote methods callable via script: Web services and page methods. You can either call Web methods defined on an ASP.NET Web service or invoke ad hoc methods defined on the same page class. Clearly, page methods are a faster solution to write and form a simple solution whose scope never exceeds the boundaries of the page. Web services, on the other hand, promote a broader form of reusability and interoperability. Today Atlas supports ASP.NET Web services expressed as ASMX resources, and in the future it will support Windows® Communication Foundation services expressed as SVC resources and hosted by IIS. For simplicity, let's opt for a page method. Note, though, that the CoreDataService class can easily be encapsulated in a wrapper Web service. All you have to do is create a proxy class and decorate methods on that proxy with the WebMethod attribute. A set of page methods allows you to publish a given page as a Web service in the context of the application. You define the page methods available for Atlas remote calls through a script tag:
See less »
Kaboodle will send you a newsletter and updates from your friends. You can unsubscribe at any time. Kaboodle does not sell or share your email address or personal information with anyone.
Kaboodle requires all users to provide their real date of birth as both a safety precaution and as a means
of preserving the integrity of the site. You will be able to hide this information from your profile if you wish.
Added by 1 people