views:

27

answers:

1

Hello there. I'm starting with Castle ActiveRecord.

In my application I have a tool create a new data base file (I use SQLite). I create new data base by use ActiveRecordStarter.Initialize() and ActiveRecordStarter.CreateSchema(), then I add some data to this data base.

After this I want to disconnect to this database and connect to another, which have the same structure (I use the same model class).

How I can disconnect to one database, and open new connection?

thanks for help.

A: 

You can try uninitializing your instance then starting you initialization again.

Reset initialization with:

ActiveRecordStarter.ResetInitializationFlag();

For the second initialization you can either point at a different config file if you're using an XmlConfigurationSource, or pass a new connection string if you're using an InPlaceConfigurationSource.

This method is normally used in test cases where you're creating your schema, running your test, then tearing down and starting again, but it may be appropriate here.

Chris Wallis