Good work! I try to integrate the Migration Framework in my application and 
it looks good!

But now I need some informations in my migration class and I want to add 
constructor parameters. Currently, your NHibernate.Migrations.Migrator 
initializes the migration classes without parameters. 
(Activator.CreateInstance(t))

I want to use a dependency injection framework. Can you change the migrator 
like this or should I write my own migrator?

public Migrator(ISessionFactory sessionFactory, Func<System.Type, object> 
createInstance = null)
{
 if (createInstance == null)
 createInstance = Activator.CreateInstance;


 _sessionFactory = (ISessionFactoryImplementor)sessionFactory;


 var migrationVersionStoreFactory = _sessionFactory.Settings.
MigrationVersionStoreFactory;


 if (migrationVersionStoreFactory == null)
 {
 throw new HibernateConfigException(
 "Tried to initialize a migrator without setting 
migration.versionstorefactory");
 }


 _migrationVersionStore = migrationVersionStoreFactory.
GetMigrationVersionStore(_sessionFactory, _sessionFactory.Settings.
MigrationContext);
 
 
 _registeredMigrations = _sessionFactory.Settings.RegisterdMigrations
   .Select(t => createInstance(t))
   .Cast<IMigration>()
   .OrderBy(x=>x.GetVersion(), new MigrationVersionComparitor())
   .ToList();


}

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to