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

  • Home
  • SEARCH
  • 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 100741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:38:15+00:00 2026-05-11T00:38:15+00:00

Are there any O/R mappers out there that will automatically create or modify the

  • 0

Are there any O/R mappers out there that will automatically create or modify the database schema when you update the business objects? After looking around it seems that most libraries work the other way by creating business object from the database schema.

The reason I’d like to have that capability is that I am planning a product that stores its data in a database on the customer’s machine. So I may have to update the database schema when a new version comes out.

Another requirement is that the mapper supports a file based database like SQLite or JET, not only SQL server.

I know XPO from Developer Express has that capability but I was wondering if there are any alternatives out there.

Thanks

  • 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. 2026-05-11T00:38:15+00:00Added an answer on May 11, 2026 at 12:38 am

    SubSonic does what you need. It has a migration class to be use with sonic commander. I modified the code and put it in the startup of my apps, and have it check for version difference and upgrade automatically. This is how you need to setup it up:

    1. You need to add the versioned migration class. You might want to take a look at this tutorial if you never used SubSonic before. The following class is saved as \Migrations\001_initial.cs, if you called migrate.exe (inside VS) from subsonic, it will update the current db to the latest version available. You need to keep the 3 digit version prefix as your filename for migrate.exe to work properly as mentioned in the tutorial. As for the class name, the underscore and 3 digit version prefix is needed for the migration class written by myself to detect the version properly.

    //*Not sure why I need this line to make the code block working below

    namespace MyApps.Migrations {     public class _001_Initial : Migration     {         public override void Up()         {             //Execute your upgrade query here         }         public override void Down()         {             //Execute your downgrade query here         }     } } 
    1. Called CheckForMigration() during the startup of your application. IsUpdateAvailable will indicate that you need to update the db. You just need to call Migrate(). IsAppVersionOlder indicate that your application is made with older version db schema (maybe another copy of the newer apps has updated the db). With, you can prevent the older apps from running and corrupting your updated db.

    //

    using System; using System.Collections.Generic; using SubSonic; using SubSonic.Migrations;  namespace MyApps.Migrations {     internal static class MigrationHelper     {         const string NameSpace = 'MyApps.Migrations';         private const string SCHEMA_INFO = 'SubSonicSchemaInfo';         public static int CurrentVersion { get { return currentVersion; } }         public static int AppVersion { get { return latestVersion; } }         public static bool IsUpdateAvailable { get { return (updateVersion.Count > 0); } }         public static bool IsAppVersionOlder { get; private set; }         public static bool Checked { get; internal set; }         private static int currentVersion;         private static int latestVersion;         private static List<string> updateVersion;         private static List<string> availableVersion;          static MigrationHelper()         {             Checked = false;         }          /// <summary>         /// Migrates the specified migration directory.         /// </summary>         public static void CheckForMigration()         {             currentVersion = Migrator.GetCurrentVersion('YourProviderName');             Type[] allTypes =                         System.Reflection.Assembly.GetExecutingAssembly().GetTypes();             availableVersion = new List<string>();             foreach (Type type in allTypes)             {                 if (type.Namespace == NameSpace)                     if (type.Name.Substring(0, 1) == '_')                         availableVersion.Add(type.Name);             }              availableVersion.Sort();             updateVersion = new List<string>();             foreach (string s in availableVersion)             {                 int version = 0;                 if (int.TryParse(s.Substring(1,3), out version))                 {                     if (version > currentVersion)                     {                         updateVersion.Add(s);                     }                     latestVersion = version;                 }             }             IsAppVersionOlder = (latestVersion < currentVersion);             //log.WriteLine(string.Format(             ///'CheckForMigration: DbVer = {0}, AppVer = {1}, UpdateAvailable = {2}, IsAppOlder = {3}',                 //currentVersion, latestVersion, updateVersion.Count, IsAppVersionOlder));             Checked = true;         }          internal static void Migrate()         {             foreach (string s in updateVersion)             {                 Migration _migration = (Migration)Activator.CreateInstance(                     System.Reflection.Assembly.GetExecutingAssembly().GetType(                     'MyApps.Migrations.' + s));                 _migration.Migrate('YourProviderName', Migration.MigrationDirection.Up);                 IncrementVersion();             }         }          private static void IncrementVersion()         {             new Update(SCHEMA_INFO,              'YourProviderName').SetExpression('version').EqualTo('version+1').Execute();         }      } } 

    A table named SubSonicSchemaInfo will be added automatically by SubSonic to your db to help keep track of the db version.

    It’s a long post, hope I didn’t missed anything

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

Sidebar

Ask A Question

Stats

  • Questions 98k
  • Answers 98k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's called the GROUP BY clause: SELECT keyword, date, COUNT(1)… May 11, 2026 at 7:39 pm
  • Editorial Team
    Editorial Team added an answer I'd recommend building as a statc library rather than a… May 11, 2026 at 7:39 pm
  • Editorial Team
    Editorial Team added an answer Welcome to the IE box model bug May 11, 2026 at 7:39 pm

Related Questions

I've got a database, and an entityset created by the O/R-Mapper, using all this
I'm interested in creating a game that uses fractal maps for more realistic geography.
I've seen a lot of questions related to mapping DTOs to Domain Objects, but
I am currently working on rewriting an application to use Data Mappers that completely

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.