RIA services exposing & consuming queries

  • Published on
    05-Dec-2014

  • View
    4.413

  • Download
    0

Embed Size (px)

DESCRIPTION

Slides from week 8 of the Inland Empire .NET User's Group Silverlight 4 class

Transcript

  • 1. Week 7 WCF RIA Services Overview
    Jim LaVine
    jim.lavine @gmail.com
  • 2. Remaining Schedule
    1-8 Exposing and consuming querying services
    1/15 Updating data
    1/22 Business Logic and validation
  • 3. Agenda
    Domain query rules
    The DomainContext Class
    Asynchronous loading
    Client-side data caching
    Shaping data in the client
    Retrieving object hierarchies
    A peak under the hood
  • 4. Design-time workflow
    Server project
    Client project
    Domain Service
    CRUD
    Domain Service
    Domain Context
    Load
    2
    Invoke
    Custom
    logic
    Build
    Entity Container
    Data model
    Metadata
    Entity
    Metadata
    Entity proxy type
    3
    Metadata
    Entity
    Metadata
    Entity proxy type
    Metadata
    Entity
    Metadata
    Entity proxy type
    1
    DAL
    Bindable
    UI Views
    L2S
    EF
    REST/SOAP
    POCO
    4
  • 5. Domain query operation rules
    IEnumerable
    IQueryable

    [EnableClientAccess()]publicclassChinookDomainService:LinqToEntitiesDomainService{publicIEnumerableGetInvoiceByCustomer(intcustomerId){returnObjectContext.Invoices.Where(c=>c.CustomerId ==customerId);}publicCustomerGetCustomerById(intcustomerId){returnObjectContext.Customers.Where(c=>c.CustomerId==customerId);}}
    public
    Supported
    types
    Entity
    publicIEnumerableGetCustomersByJoinData(DateTimemindate, DateTimemaxdate){
    returnObjectContext.Customers.Where(c=>c.JoinDate>=mindate && c.JoinDate { /* Check for errors, bind to UI, do work */},
    null);
    ctx.Load(query).Completed += newEventHandler(LoadComplete);
    voidLoadComplete(object sender, EventArgs e)
    {/* Check for errors, bind to UI, do work */ }
  • 14. LoadOperation
    Load Operation:
    • AllEntities
    • 15. Entities
    • 16. EntityQuery
    • 17. TotalEntityCount
    OperationBase:
    • INotifyPropertyChanged
    • 18. IsComplete, Completed, event
    • 19. Cancel(), CanCancel, IsCanceled
    • 20. Error, HasError