title: Self hosting RIA Services in WPF executable & Referencing SL RIA Class Library
body: <p>I want to use a RIA Services in WPF (Please hear me out before voting to close this :)).
  I learned about <a href="http://blogs.msdn.com/b/davrous/archive/2010/12/03/how-to-open-a-wcf-ria-services-application-to-other-type-of-clients-the-soap-endpoint-3-5.aspx" rel="nofollow noreferrer">being able to use RIA Services for other clients</a>.  Also looked at the sample progam (the famous HRApp) for <a href="http://code.msdn.microsoft.com/RiaServices/Release/ProjectReleases.aspx?ReleaseId=3587" rel="nofollow noreferrer">consuming DomainServices from WPF</a> using RIA Services Toolkit.  </p>
  
  <p>Unfortunately, none of it gave what I needed (explained below).</p>
  
  <p>I was struck by a thought when I was looking through the <a href="http://msdn.microsoft.com/en-us/library/ee707351(v=vs.91).aspx" rel="nofollow noreferrer">walkthrough for making the RIA service client context &amp; the domain services into reusable class libraries</a>.</p>
  
  <p>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 <a href="https://stackoverflow.com/questions/2598445/can-wcf-ria-services-be-self-hosted/3403951#3403951">this trick</a> inside my WPF app.</p>
  
  <p>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).</p>
  
  <p>My needs are this:</p>
  
  <ol>
  <li>Self-host a WCF service that allows me to CRUD (without me writing any code).</li>
  <li>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 </li>
  <li>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)</li>
  <li>My application is very simple (3 tables at the most).  Very simple querying needs</li>
  <li>Be able to use ADO.Net Entity Model (and Entity)</li>
  <li>Allows me to extend my entity classes akin to what RIA offers</li>
  </ol>
  
  <p>Any pointers as to what my options are would be greatly appreciated.</p>
  
  <p>Thanks in advance.</p>