none
Sync to SQL Server through Entity Framework RRS feed

  • Question

  • Hello,

      I have made a Sync based on the sample program 'WebSharingAppDemo-CEProviderEndToEnd'. The server is SQL Server 2008 and the clients will be SQL CE. In the example program, an open connection to the DB is needed to obtain the SQL Server provider. The Server DB I want to sync with is only communicated with via a WCF service running that connects to the DB using entity framework. Do I have to have the open connection to the database to do the Sync or is there some workaround?

    Thanks, Hank

    Thursday, March 24, 2011 3:35 PM

Answers

  • You can alter the sample application so that the server connection is only setup on the WCF service side (stored and retrieved from web.config). The client needs only to know the WCF endpoint to the service and not the actual server connection.

    • Marked as answer by HankAnzis Friday, March 25, 2011 3:07 PM
    Thursday, March 24, 2011 11:28 PM
    Moderator

All replies

  • You can alter the sample application so that the server connection is only setup on the WCF service side (stored and retrieved from web.config). The client needs only to know the WCF endpoint to the service and not the actual server connection.

    • Marked as answer by HankAnzis Friday, March 25, 2011 3:07 PM
    Thursday, March 24, 2011 11:28 PM
    Moderator
  • Thanks JuneT.

    I'm an newbie to WCF. Is there an example program you may know of that could guide me?

    Hank

    Friday, March 25, 2011 2:05 PM
  • the EndToEnd samples from MS is probably the best reference you have right now for synching over WCF using the SqlSyncProvider and SqlCeSyncProvider. am working on a revised version of those sample applications that's IIS hosted but I havent found time to complete it yet.

    the sample you have is self hosted. just find the part where it needs the connection string on the service side and retrieve it from a config file instead of relying on the connection string from the client.

    Friday, March 25, 2011 2:14 PM
    Moderator
  • Thanks again JuneT,

      I'll give it a shot. The examples use the SQL connection for configuring the provider and I know I won't need that, but it also needs the connection for making the SQL proxy. I should be able to change the RelationalProviderProxy to get the internal connection and not have it passed from the application, if I understand that correctly.  I'm not sure what you mean by passing the endpoint instead of the openconnection, but maybe I won't need to.

    Hank

    Friday, March 25, 2011 2:41 PM
  • i'm referring to the WCF endpoint. the client should only connect to the WCF service. the  service should be the one connecting to the database server. the client should not care or know which server and database the WCF service connects to.
    Friday, March 25, 2011 3:01 PM
    Moderator
  • Hi Hank,

    Can you please share your experience, as I am trying to achieve the same.

    Thank you

    Friday, October 21, 2011 12:01 AM
  • Hello,

     I retrieved the connection string from WCF  and connected that way to Synch with the SQL CE.

    Friday, October 21, 2011 2:19 PM