tags:

views:

56

answers:

1

I'm looking at using SubSonic 3 as my preferred OR mapper on a new project and have a question that I can't seem to find an answer to...

I'm looking to use the SimpleRepository approach, and I've noticed that I can specify a "SimpleRepositoryOption" parameter which appears to be a hint to SubSonic as to whether it should cascade schema changes to the DB or not.

My question is should I be enabling this in development (SimpleRepositoryOption.RunMigrations) and then disable it for the live environment (SimpleRepositoryOption.None)? Or is there a way of using a config setting to determine whether these schema updates will take place or not?

I'm just assuming that once I've got a (relatively) fixed generated DB schema I don't want to SubSonic to be interrogating it for changes everytime I perform a CRUD operation. Unless of course SubSonic somehow manages this itself without impacting performance.

Thanks in advance :)

+1  A: 

Make sure to disable it completely in a live environment. There's no config setting for it at this time.

Rob Conery
Many thanks, Rob. Presumably I can infer from this that there would be a performance hit should RunMigrations be set?
Mr Bog
Yes, there is a performance hit in SQL. If you run SQL Profiler, you will see that when you have RunMigrations set that the internal Migrator() function in SubSonic executes several SQL queries. In order: Query Columns for Type, Execute ALTER statements for each Column of that Type (1 query for each column), and then execute any default data for new columns. It should be noted that there is a check for each SimpleRepository that only allows this once, per instance. I.e., keep it a Singleton approach.
eduncan911