1. Silverlight 2.0 Dave Allen ISV Application Architect Developer and Platform Group Microsoft UK
2. Agenda Networking Web Services ADO.NET Data Services WebClient Sockets Isolated Storage File Open Dialog Background processing Host page interaction
3. Web Services Supports WCF or ASMX bascHttpBinding only HTTP or HTTPS GET or POST only 200 and 404 only status codes supported SOAP, POX, JSON, or RSS serialization X-Domain calls require a Policy file All communications have to be asynchronous
5. ADO.NET Data Services Data publishing service using a RESTful interface Just uses HTTP Therefore is able to use existing authentication mechanisms, and other infrastructure components such as caching and proxies Uniform URL Syntax Every piece of information is addressable Predictable and flexible URL syntax Multiple representations ATOM JSON POX
6. ADO.NET Data Services (2) Exposes an object model (not a database) over the web Entity Data Model – ADO.NET DS designed to work with EDM LINQ To SQL model, read-only Custom IQueryable<T> provider Operation semantics, mapping of HTTP verbs for CRUD operations GET – retrieve resource POST – create a resource PUT – update a resource DELETE – delete a resource
9. Isolated Storage Ability to interact with local file system Virtual file system supporting single files or a directory of files Limited size based on quota, default to 1Mb Per user, per application or per site/domain Can check quota size or available space Can be increased through user prompt
10. File Open Dialog Prompt users for file names Similar to OpenFileDialog in WinForms Supports file filters, *.jpg, etc. Supports multiple file seclection Only have access to file name, not the path File is read only
12. Background processing Keeps the user interface interactive Useful when operation length is unknown E.g. any outbound network call Fits well with Silverlightasync programming model Spawn a new thread using BackgroundWorker
14. Host page interaction Two-way communication Call .NET Silverlight methods from JavaScript Call JavaScript funcrtions from Silverlight Pass complex structures between them .NET Code needs to be attributed [ScriptableType] for the class [ScriptableMember] for methods and properties Scriptable code needs to be registered HtmlPage.RegisterScriptableObject(id,this)
15. Host page interaction (2) Types in System.Windows.Browser Start with an HtmlPage Grab an HtmlDocument or HtmlWindow Work with HtmlElement instances Work with DOM and JavaScript types Invoke methods GetProperty and SetProperty types On an HtmlElement GetAttribute and SetAttribute AttachEvent and DetachEvent handlers
Representational State Transfer (REST) is an architectural pattern used in the design of services. REST is about the way in which you expose and make available to callers the contract of the service. REST, therefore, is opposed to SOAP. ADO.NET Data Services’ RESTful interface uses a common URL syntax that clients can learn and leverage across all data services This makes it easy to consume new data services once you’re familiar with the syntax
It’s important to note that the “Data” in “Data Services” isn’t referring to a database. A data service is meant to expose data, of any kind over the web, in a standard, and easily consumable fashion. A data service is capable of exposing any object model that contains public properties of type IQueryable<T>. This criteria matches LINQ To SQL, and the Entity Framework, but can just as easily fit a custom object model. Data services implements the Atom Publishing Protocol (AtomPub or APP): Maps HTTP verbs to CRUD operations: GET = Read POST = Create PUT = UpdateDELETE = Delete Exposes the data in the form of Atom feeds and entries