I don't know the details about how AR works, but I do understand how
NH works, and AR is just an implementation on top of NH. You can
create either :
1. a custom driver/connection string builder to connect to different
databases. this works well for multi-tenet applications. were the db
model is the same, but the instances are unqiue.
2. build multiple session factories, one for each database and
reference them accordingly. you can name a NH session factory and use
this as the key to resolve it.

I would imagine AR would allow for multiple instance, similar to NH
allowing multiple session factories.

On Nov 5, 8:42 am, Vladimir <[email protected]> wrote:
> Hi.
>
> I have a desktop application with AR support for database operations.
> Everything worked, everything was excellent.
>
> But now I need to make plugins-support model for my program. Every
> plugin is separate assembly, which dynamicly loads at runtime an do
> some work. Problem is that some of plugins also needs to use their own
> databases.
>
> My experiments:
> 1. At first, I thought that I can separately initialize AR connection
> in my main application and in each plugin, which need database support
> - but no! I can not call ActiveRecordStarter.Initialize() in plugin
> assembly (exception "already called"). Not working even in another
> AppDomain.
> 2. If in plugin assembly I call ResetInitializationFlag() and then
> Initialize() - I have my connection to plugin's database, but lost
> main database connection (this wasn't surprise)
> 3. Of course I can not Initialize all plugins database connection in
> main application - i do not know their properties (only plugins know
> them) and also i will have near hundred plugins and I do not want to
> create at startup hundred of connections - only when user will load
> and use some plugin.
> 4. DifferentDatabaseScope not working. I think it also requires
> database connection properties of all databases before Initialize -
> but I do not have them at moment when I connect to the first database.
> 5. ActiveRecordStarter.RegisterTypes helps to introduce AR types, that
> I want to use in plugin, but when I trying to make some request - I
> have just empty recordset. I think AR does not understand from which
> database I want to load data.
>
> That is all. For now, I think that it is impossible to dynamicaly
> connect to and disconnect from different databases without breaking
> the connection with opened at first Initialize() database. Am I right?

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to