Silverlight 2.0

429 views

Published on

Silverlight 2.0

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
429
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • SilverlightWeb Services project
  • 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
  • http://localhost/AWDataServices/WebDataService.svc/Producthttp://localhost/AWDataServices/WebDataService.svc/Product(324)http://localhost/AWDataServices/WebDataService.svc/Product(324)/Namehttp://localhost/AWDataServices/WebDataService.svc/Product(324)/Name/$valuehttp://localhost/AWDataServices/WebDataService.svc/ProductSubcategory(2)/Producthttp://localhost/AWDataServices/WebDataService.svc/ProductSubcategory(2)/Product(789)/Namehttp://localhost/AWDataServices/WebDataService.svc/Product?$orderby=Namehttp://localhost/AWDataServices/WebDataService.svc/Product?$filter=Color%20eq%20'Black‘http://localhost/AWDataServices/WebDataService.svc/Product?$top=10&$skip=30http://localhost/AWDataServices/WebDataService.svc/ProductSubcategory?$expand=Product
  • http://localhost/AWDataServices/WebDataService.svc/Producthttp://localhost/AWDataServices/WebDataService.svc/Product(324)http://localhost/AWDataServices/WebDataService.svc/Product(324)/Namehttp://localhost/AWDataServices/WebDataService.svc/Product(324)/Name/$valuehttp://localhost/AWDataServices/WebDataService.svc/ProductSubcategory(2)/Producthttp://localhost/AWDataServices/WebDataService.svc/ProductSubcategory(2)/Product(789)/Namehttp://localhost/AWDataServices/WebDataService.svc/Product?$orderby=Namehttp://localhost/AWDataServices/WebDataService.svc/Product?$filter=Color%20eq%20'Black‘http://localhost/AWDataServices/WebDataService.svc/Product?$top=10&$skip=30http://localhost/AWDataServices/WebDataService.svc/ProductSubcategory?$expand=ProductSilverlightADODataServices project
  • SilverlightLocalInteraction project
  • Silverlight 2.0

    1. 1. Silverlight 2.0<br />Dave Allen<br />ISV Application Architect<br />Developer and Platform Group<br />Microsoft UK<br />
    2. 2. Agenda<br />Networking<br />Web Services<br />ADO.NET Data Services<br />WebClient<br />Sockets<br />Isolated Storage<br />File Open Dialog<br />Background processing<br />Host page interaction<br />
    3. 3. Web Services<br />Supports WCF or ASMX<br />bascHttpBinding only<br />HTTP or HTTPS<br />GET or POST only<br />200 and 404 only status codes supported<br />SOAP, POX, JSON, or RSS serialization<br />X-Domain calls require a Policy file<br />All communications have to be asynchronous<br />
    4. 4. Demo<br />Silverlight 2.0 Web Services<br />
    5. 5. ADO.NET Data Services<br />Data publishing service using a RESTful interface<br />Just uses HTTP<br />Therefore is able to use existing authentication mechanisms, and other infrastructure components such as caching and proxies<br />Uniform URL Syntax<br />Every piece of information is addressable<br />Predictable and flexible URL syntax<br />Multiple representations<br />ATOM<br />JSON<br />POX<br />
    6. 6. ADO.NET Data Services (2)<br />Exposes an object model (not a database) over the web<br />Entity Data Model – ADO.NET DS designed to work with EDM<br />LINQ To SQL model, read-only<br />Custom IQueryable<T> provider<br />Operation semantics, mapping of HTTP verbs for CRUD operations<br />GET – retrieve resource<br />POST – create a resource<br />PUT – update a resource<br />DELETE – delete a resource<br />
    7. 7. URL Conventions<br />Addressing entities and sets<br />Presentation options<br />
    8. 8. Demo<br />Silverlight & ADO.NET Data Services<br />
    9. 9. Isolated Storage<br />Ability to interact with local file system<br />Virtual file system supporting single files or a directory of files<br />Limited size based on quota, default to 1Mb<br />Per user, per application or per site/domain<br />Can check quota size or available space<br />Can be increased through user prompt<br />
    10. 10. File Open Dialog<br />Prompt users for file names<br />Similar to OpenFileDialog in WinForms<br />Supports file filters, *.jpg, etc.<br />Supports multiple file seclection<br />Only have access to file name, not the path<br />File is read only<br />
    11. 11. Demo<br />Isolated Storage and File Open Dialog<br />
    12. 12. Background processing<br />Keeps the user interface interactive<br />Useful when operation length is unknown<br />E.g. any outbound network call<br />Fits well with Silverlightasync programming model<br />Spawn a new thread using BackgroundWorker<br />
    13. 13. Demo<br />Background processing<br />
    14. 14. Host page interaction<br />Two-way communication<br />Call .NET Silverlight methods from JavaScript<br />Call JavaScript funcrtions from Silverlight<br /> Pass complex structures between them<br />.NET Code needs to be attributed<br />[ScriptableType] for the class<br />[ScriptableMember] for methods and properties<br />Scriptable code needs to be registered<br />HtmlPage.RegisterScriptableObject(id,this)<br />
    15. 15. Host page interaction (2)<br />Types in System.Windows.Browser<br />Start with an HtmlPage<br />Grab an HtmlDocument or HtmlWindow<br />Work with HtmlElement instances<br />Work with DOM and JavaScript types<br />Invoke methods<br />GetProperty and SetProperty types<br />On an HtmlElement<br />GetAttribute and SetAttribute<br />AttachEvent and DetachEvent handlers<br />
    16. 16. Demo<br />Host page interaction<br />

    ×