Search code examples
wpfriawcf-ria-servicesself-hosting

Self hosting RIA Services in WPF executable & Referencing SL RIA Class Library


I want to use a RIA Services in WPF (Please hear me out before voting to close this :)). I learned about being able to use RIA Services for other clients. Also looked at the sample progam (the famous HRApp) for consuming DomainServices from WPF using RIA Services Toolkit.

Unfortunately, none of it gave what I needed (explained below).

I was struck by a thought when I was looking through the walkthrough for making the RIA service client context & the domain services into reusable class libraries.

My idea is this: Have a SL class library maintain a RIA Link to a Domain Service class library. Reference SL Class library (now extended with my own entity extensions) in WPF. Also Reference the DomainService as a class library and then Self-host using this trick inside my WPF app.

Unfortunately, the code is not compiling if I add System.Windows.dll to my WPF project. (Resharper additionaly complains I need to add System.dll too... but that appears at the moment to be a false alarm).

My needs are this:

  1. Self-host a WCF service that allows me to CRUD (without me writing any code).
  2. The WPF exe that self-hosts can accept connections from instances of the same executable running within LAN with just firewall configuration (where needed). In other words, I want the application to work as a server for its own copies running on other machines OR a standalone client
  3. Just by changing a Option inside the program (or app.config) I can connect to a difference instance (for data consolidation and other processing on the server)
  4. My application is very simple (3 tables at the most). Very simple querying needs
  5. Be able to use ADO.Net Entity Model (and Entity)
  6. Allows me to extend my entity classes akin to what RIA offers

Any pointers as to what my options are would be greatly appreciated.

Thanks in advance.


Solution

  • WCF Data Services was (formerly ADO.Net Data Services & Astoria) what I was looking for. It's remarkably similar to RIA Services.

    It satisfies 4, 5, & most importantly #6 of my needs. I was able to self host simply by referencing the Service assembly solving #1, #2. I wasn't really looking for answer for #1 - #3 anyway.