Search code examples
asp.net-mvcvb.netscaffolding

How to use DropCreateDatabaseIfModelChanges in VB.net


How can I use DropCreateDatabaseIfModelChanges in a VB.NET application in an early development state where the model changes quite often. I know I have to add those lines to Global.asax - but I only found examples using C# - could someone please give me a hand?


Solution

  • Got it: global.asax.vb

    Imports System.Data.Entity
    ...
    Database.SetInitializer(New DropCreateDatabaseIfModelChanges(Of <ENTITYNAME>)())