Handling schema changes at run-time

Last post 07-08-2009 10:35 AM by sjnaughton. 5 replies.

Sort Posts:

  • Handling schema changes at run-time

    07-07-2009, 1:29 PM

    I am new to ASP.NET Dynamic Data and trying to find out if Dynamic Data technology could accomadate a use-case when DB schema changes at run-time. Example: Can and how Dynamic Data application templates can pick-up a new field that was added to a DB at run-time using Transact SQL "ALTER TABLE 'table' ADD 'column' ..."  ?

  • Re: Handling schema changes at run-time

    07-07-2009, 5:58 PM
    • Star
      12,250 point Star
    • sjnaughton
    • Member since 04-29-2008, 5:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,558
    • TrustedFriends-MVPs

    le_chocolatier:
    use-case when DB schema changes at run-time
     

    DD loads the metadata at Application Start and cannot be reloaded without restarting the app.

    However in the latest Preview (4) on codeplex you can a simple DD sample which uses simple classes to do the auto scaffolding.

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
    Filed under:
  • Re: Handling schema changes at run-time

    07-08-2009, 2:03 AM
    • Contributor
      2,190 point Contributor
    • davidfowl
    • Member since 08-17-2008, 9:50 PM
    • Redmond
    • Posts 450
    • Moderator

    There are new method calls that in DD Preview 4 that can be used to reset the metadata cache. MetaTable.ResetMetadata() but thats only for metadata. Since dd is based on the clr classes and not SQL directly (though you could write a provider that did that) you'd have to find some way of regenerating data model.

    David Fowler
    SDE, ASP.NET Team, Microsoft
  • Re: Handling schema changes at run-time

    07-08-2009, 5:22 AM
    • Star
      12,250 point Star
    • sjnaughton
    • Member since 04-29-2008, 5:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,558
    • TrustedFriends-MVPs

    davidfowl:
    There are new method calls that in DD Preview 4 that can be used to reset the metadata cache. MetaTable.ResetMetadata()
     

    That's an interesting bit of news David is that new tp the refresh?

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
    Filed under:
  • Re: Handling schema changes at run-time

    07-08-2009, 9:24 AM
    • Contributor
      2,190 point Contributor
    • davidfowl
    • Member since 08-17-2008, 9:50 PM
    • Redmond
    • Posts 450
    • Moderator

    It's actually been there for a while I think we just failed to communicate it. There is MetaColumn.ResetMetadata() also.

    Let me know if you need any more details on this.  I'm putting together a sample of changing metadata at runtime :).

    Hope this helps

    David Fowler
    SDE, ASP.NET Team, Microsoft
  • Re: Handling schema changes at run-time

    07-08-2009, 10:35 AM
    • Star
      12,250 point Star
    • sjnaughton
    • Member since 04-29-2008, 5:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,558
    • TrustedFriends-MVPs

     That's cool David let me know when you have your sample ready and I have a look.

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
    Filed under:
Page 1 of 1 (6 items)