Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 756157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:12:47+00:00 2026-05-14T15:12:47+00:00

Background – I need a framework/approach to managed database updates for a .NET Winforms

  • 0

Background – I need a framework/approach to managed database updates for a .NET Winforms app being deployed on users PC’s via clickonce deploy. The app uses a sqlite database.

Q1. What mechanism does Subsonic use to run such migrations on the local PC? e.g. would it be MSBuild

Q2. If it does need a tool like how can my application robustly kick off MsBuild? i.e. how can it be sure what path it is installed, what if it is not installed, should I be including the MSBuild.exe in the clickonce package so that I know it is there for sure myself?

Q3. Any other suggestions on how to use Subsonic in this specific use case?

Q4. Any comments on whether MigratorDotNet would be a better fit? (if someone has had experience with both)

Q5. Could I use subsonic’s bare migration framework and just have a set of SQL files to do the upgrade/downgrade? i.e. just use the framework to check database version and which scripts to run etc?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:12:47+00:00Added an answer on May 14, 2026 at 3:12 pm

    Well, the post is a little old but maybe my answers are still of use.

    Q1: SubSonic Migrations are code files that are complied and executed at runtime by subcommander (sonic.exe) which means the code files have to be on disk and must follow the naming convention 001_migration_name.cs for subcommander to know the execution order.

    Q2: You don’t need msbuild for migrations. The only thing you need is the sonic.exe and it’s dependencies.

    Q3: It is possible (and not very hard) to create your own logik to execute the migrations in your project at runtime without using subcommander.

    I basically find every class that is derived from Migration and (since a class cannot start with a number) my convention is that the last 3 digits from the class name are the migration number (like the 001_migration_name.cs my classes are defined as Migration001 : Migration)

    public class MigrationHelper
    {
        private const string providerName = "MyProviderName";
        public static int CurrentVersion { get { return SubSonic.Migrations.Migrator.GetCurrentVersion(providerName); } }
    
        private static Dictionary<int, Migration> _migrations;
        public static Dictionary<int, Migration> Migrations
        {
            get
            {
    
                if (_migrations == null)
                {
                    _migrations = new Dictionary<int, Migration>();
                    foreach (Type t in new MigrationHelper().GetType().Assembly.GetExportedTypes())
                    {
                        if (t.BaseType == typeof(SubSonic.Migration))
                        {
                            int number;
                            if (int.TryParse(t.Name.Substring(t.Name.Length - 3, 3), out number))
                                Migrations.Add(number, (Migration)Activator.CreateInstance(t));
                            else
                                throw new InvalidOperationException("Classes that inherit SubSonic Migrations have to be named MigrationXXX where x is the unique migration number");
                        }
                    }
                }
                return _migrations;
    
            }
        }
    
        public static void ExecuteMigration(Migration m, Migration.MigrationDirection direction)
        {
            m.Migrate(providerName, direction);
        }
    
    
    }
    

    In your programm you can determine the current version by MigrationHelper.CurrentVersion and then execute every single migration from current to max (if you wanne go up) or some other number. Here is how you use it.

            Migration m = MigrationHelper.Migrations[15];
            MigrationHelper.ExecuteMigration(m, Migration.MigrationDirection.Up);
    

    Q4: I don’t have experience with MigratorDotNet but if your app uses subsonic than the subsonic migrations are a good choise since you don’t need to deploy any additional libs.

    Q5: You can use subsonic migrations for that. Just do:

    Execute("CREATE TABLE ...");
    

    in the Up() or Down() method. But the advantage of using the predefined methods are (besides the fact that they work across multiple dbms’ which is propable not so importent if you only use sqlite) is that you have some pre flight checks (e.g. a migration will fail if you define a field twice before the actual sql is executed)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I am developing an app which sends an SMS to users after registration
Background: What I need to accomplish is to remove any records in a collection
Background: Using unix, codeigniter from localhost. I'd like to run a controllers via a
Background I am writing code in VS 2010, .NET 4, C#. Also, in case
Background A lot of work has gone into optimizing database design, especially in the
Background We currently use OpenID for authentication of users, and use the Claimed Identity
Background: I'm testing a function within an ASP.NET 4.0 (Web Forms not MVC) and
Background: I am programming a .NET compiler (very similar to C#) for a school
Background: I have several builds running on a Windows Server 2003 R2 machine via
BACKGROUND I'm using VS 2010 on a machine where I installed .Net 4.5 which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.