|
Download WebPortal
|
|
|
Download and start using the full WebPortal completely free, including the source for the basic modules so you can see how to create your own if the included modules aren't enough.
|
|
Subscribe
|
|
Get It All for $50 USD:
WebPortal, ORMapper,
Source Code, All Updates
|
|
User Login
|
|
|
|
|
|
Wilson WebPortal Forums : Other Databases : Multiple 'other' database.
|
|
| 3/13/2006 9:50:53 PM |
Hi Paul,
Hope this is the correct forum for this.
I currently host a web application for a number of clients. The same web application, and web service, is copied around to different customer directories on the same server, and each has their own database instance. Each customer simply accesses his/her website by specifiing the directory (eg. www.mysite.com/customer1, www.mysite.com/customer2, etc). I use ORMapper throughout my web application, and webservice, and also use UIMapper.
I have toyed with the idea of using DotNetNuke to consolidate my application into one, and split it into portals. I gave up this notion, though, as time was a constraint, and DNN was a bit top-heavy for my requirements. The WebPortal is a lot less complicated, and I'd love to use it.
How could I go about using the WebPortal to consolidate my applications into one, and, depending on user login, use the relevant database? The database tables are all named the same, in each database e.g. MyDatabase_Users, MyDatabase_Roles, MyDatabase_Customer...
I would like to have only one instance of the WebPortal, containing different portals that can be referenced by different URLs by customer e.g. http://www.mymainsite.com/customer1, http://www.mymainsite.com/customer2 and (using the aliases) domain names (www.mycustomer1.com, www.mycustomer2.com).
Any info, greatly appreciated.
Thanks,
Sean D. |
| 3/13/2006 10:05:12 PM |
Hi Sean:
The WebPortal by default will have all portals use the same database, but of course each one will have separate data. The exception is that you can have several portals share the same group of users and roles -- but that is entirely optional, so each portal can also have totally separate groups of users and roles. How is each portal differentiated? You assign one or more aliases to each portal (www.mysite.com/customer1, etc.) and that determines which portal, and of course which group of users and roles, is used for that url. This approach is actually pretty much standard across web portals, although some aren't as flexible on sharing and/or separating groups of users and roles.
As for the UIMapper (and I accidentally deleted your other UIMapper post -- sorry, my finger slipped -- I need to put a confirmation in there), there's no reason you can't use it in modules of your own. I do hope to write a generic table list/edit module soon, but as you already know, it won't use the UIMapper per se, although a lot of the concepts are similar in my ListView and EditView controls.
Thanks, Paul Wilson
|
| 3/14/2006 12:25:48 PM |
Hi Paul,
Thanks for the response. I've set up the aliases. My only remaining problem is the multiple databases. I use the ORMapper/Manager in a satelite assembly (to my web app). I use the Singleton (static) Manager class to GetORManager (and UIManager). Given that the mapping file is exactly the same for all databases, with only the connectionstring changing, how could I structure this within the Portal to facilitate the changing strings, as they're all in the same app.
I know this isn't strictly a WebPortal or OrMapper question, but if you've already thought about this kind of thing, it'd save me a bit of time.
Many thanks for the great products.
Sean D |
| 3/14/2006 12:36:00 PM |
Hi Sean:
There are at least two very different approaches you can use.
If you are going to let there be just one "master" WebPortal database,
and only have your other databases for portal-specific content, then
you can actually create a table in the master database to hold the
connnection strings to the other databases, which would key off of the
PortalId. You could even just extend the existing wp_Portals table and
the Portal object, but that's going to make bug-fixes and upgrades
extremely difficult, where keeping it separate will make it very smooth.
The other approach would be required if you are going to have even the
WebPortal stuff in separate database, with no "master" database at
all. In this case you will need to modify the Manager class to pull the correct connection string, probably using the url to make the distinction, similar to the way the WebPortal uses aliases to make the distinction among portals. This isn't hard to do, but the first problem to note is that you are now basically having the same code as the alias code in the Controller, and pretty much making aliases pointless (although still required unless you also remove that code). You'll also be making it harder to apply bug-fixes or upgrade since you'll have changed the base, and you won't be able to setup new portals without modifying web.config to add new connection strings -- so I would really recommend the first approach.
Thanks, Paul Wilson
|
| 6/2/2006 8:56:28 AM |
Sean, which approach did you settle on. I'd like to port an existing application into WebPortal but a seperate database for each client is a requirement of ours as well. I'd be interested in hearing which you decided and what you learned from doing it.
Lloyd |
| 6/6/2006 3:27:45 PM |
Hi Lloyd,
I created a simple table in the master database, wherein I put a PortalID and database connection string.
Based on the PortalId, I then accessed the ORMapper using the connection string specified. I didn't actually write a supporting module though. It's very easy to do so, though.
As there was only a small number of tables, and the relationships are fairly simple (no N->N), I copied the code, and wrote modules for each table that use the List and EditView controls.
If I get a chance, I'm going to write a generic List and EditView with parameters pointing to ObjectType.
Hope this helps.
Stick with it, though, because it's a great product, and so easy to use. Although, I really wish Paul had brought in the UIMapper. I think he's thinking about it, or at least he's thinking about a generic table-focused List and Edit View control.
Regards,
Sean. |
|
|