Where to bootstrap?

Where to bootstrap?

Old forum URL: forums.lhotka.net/forums/t/9405.aspx


Kevin Fairclough posted on Thursday, August 19, 2010

Where do I put bootstrap code that will work for both n-tier and single tier configurations?

Especially configuring server side responsibilities.  These may not exist on the client.

Regards

Kevin

 

 

ajj3085 replied on Thursday, August 19, 2010

Usually you're hosting the server side stuff in IIS, so you can use standard asp.net techniques, such as Application_Start.

Kevin Fairclough replied on Friday, August 20, 2010

I was hoping for somewhere in Csla to do this; i.e. ClientBootstrap (not a problem normal places) ServerBootstrap (?) this could be in different places depending on configuration.  I dont really want to put the code in IIS.

I need a hook into Csla.Server.DataPortal to run my bootstrap code.  A client that may be running n-tier cannot call ServerBootstrap because the assemblies wont be there.

Regards

Kevin

 

 

ajj3085 replied on Friday, August 20, 2010

Maybe I'm misunderstanding the question, but if not I don't think there's any place in Csla to do this. 

If you're talking about bootstrapping in the Ioc / DI context, then I think my answer will work fine for you.  I'm coming from a background in StructureMap though, so maybe your IoC container doesn't have similar features.

Anyway,  your client code (before it shows any forms) can ask StructureMap to scan the folder containing the executing assembly to find any Registry classes.  So for server only stuff you put your registry classes only in your server side assemblies.  Since they won't get deployed, those registries won't be found and thus nothing scanned.  Same goes for your client assemblies on the server side.  Common registries should be in assemblies which will always be in both locations.

So like I said, I may be misunderstanding yoru question, and if I am please feel free to correct me!

HTH

andy

Copyright (c) Marimer LLC