If you are asking about the database context, the constructor usually takes the connection string.

By on 12/26/2012 3:50 PM ()

Yes, but I need to inspect the caller url to know which connection string I'm looking for.

I verified and the full url is povided during an RPC call but I wouldn't know whether there are other statics provided by the WebSharper API to get that information.

By on 12/27/2012 4:37 AM ()

You have several alternatives - here are the most obvious ones:

  1. Using the Request.Uri member on the sitelet context object.
  2. Accessing the ASP.NET request object directly.
  3. Passing down the request URL from the sitelet router to the RPC call.
By on 12/28/2012 7:41 AM ()

There must be something I don't understand. I thought the WebSharper compiler hardwired the RPC calls from JavaScript annotated code to server side RPC annotated code directly avoiding the Router/Sitelet context altogether.

That would only leave option 2.

By on 12/30/2012 1:04 PM ()

Ah yes, sorry to be confusing indeed. What I meant is that: since you have content served under different URLs calling the same RPC function, you can use Options 1 and 3 to call the common RPC function (now taking an extra string for the URL bit) from the sitelet handling those URLs. Thus you solve the issue within the sitelet mechanism - which is a good thing.

By on 12/30/2012 1:31 PM ()

Gotcha... Thanks Adam, that's not too far fetched indeed.

By on 1/13/2013 6:15 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper