Web Connection
Multi-tenant with NET best practice
Gravatar is a globally recognized avatar based on your email address. Multi-tenant with NET best practice
  Marcel DESMET
  All
  Jun 15, 2018 @ 12:40am

We have a multisite on the same server configuration every site with is own extension

I create two new handler *.blog and *.frm to add a blog and forum on every running site, both extension ( blog and frm ) had is own process and is running fine ( for the test page ) called from everywhere ( manually add the *.blog & *.frm handler on every site )

I read this https://webconnection.west-wind.com/docs/_4ks0mgboe.htm

So identify the calling site or url is not a problem, but the routerequest is a protected method so what would be the best pratice : overwrite process, onprocessinit or... to route the request

Gravatar is a globally recognized avatar based on your email address. re: Multi-tenant with NET best practice
  Rick Strahl
  Marcel DESMET
  Jun 15, 2018 @ 12:51am

Not really sure exactly what you want to do. If each site that you handle is basically running the same sub-components the logic to differentiate between them has to be inside of the process class (or the business objects). I think all you really need to do is track the site (or ID that identifies the site) and then apply that filter to your data operations.

I don't think that you need to do special routing in the code itself.

The special routing comes in only if you actually have to route to do different handlers for each site.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Multi-tenant with NET best practice
  Marcel DESMET
  Rick Strahl
  Jun 15, 2018 @ 01:39am

Thank you for your prompt reply. Yes sorry my question was not accurate .

My question is more how to handle different pages without the creation of a method

It's more a "Url rewrite" problem

Same page content would be show with different page context. The context is the site but also the type of information the idea is to apply the request on a same method for example the "showblogpage" method and change the html template page on purpose For exemples www.mysite.com/recipies.blog, www.my2site.com/recipies.blog and www.mysite.com/news.blog calls the same method

Gravatar is a globally recognized avatar based on your email address. re: Multi-tenant with NET best practice
  Marcel DESMET
  Rick Strahl
  Jun 15, 2018 @ 05:11am

Hi Rick,

I thing adding this code in the RouteRequest could do it

			OTHERWISE
				*** Consider request not found
				*** THIS SHOULD NEVER HAPPEN!
				*ASSERT .F.,"wwProcess code fell through to OTHERWISE fell through on this request"
				llError = THIS.BeforeRouteRequestError(lcScriptName)			&& .T.
		ENDCASE

As a result we could write in the BeforeRouteRequestError

DO CASE
  CASE INLIST(lcScriptName,"Scr1","Scr2" etc .. )
      DO ... MyMethod1(lcScriptName)
  OTHERWISE
      RETURN .T.
ENDCASE 
RETURN .F. 

Rather than adding a lot of method in the process

DEFINE Scr1
    DO ... MyMethod1("Scr1")
ENDDEFINE

DEFINE Scr2
    DO ... MyMethod1("Scr2")
ENDDEFINE

etc ....
© 1996-2024