Restrict updates to specific classes

Dec 2, 2015 at 1:39 PM
Would it or is it possible to restrict schema updates to specific classes or do I need to create a separate module?
Dec 2, 2015 at 4:48 PM
Restrict to specific classes - probably not, not in current version. What's your specific case, why you need this? maybe there's other way to do this, or maybe I should consider adding such capability, but I need more details.
Dec 3, 2015 at 8:59 PM
We currently have a legacy database which we are building an import service for using VITA. We need to be able to update a handful of tables but not others within the legacy database. The modules are currently Import and Legacy where Legacy is set to not auto update. Ideally it would be great to exclude / include an Entity to auto update.
Dec 3, 2015 at 9:36 PM
quite an interesting case. No direct support currently, need to think about this - how to make it easier.

One way to go is to generate update script using vdbtool and then manually edit the script, leaving only updates you need, and apply the script manually.
The other way is filtering update scripts in code. You can hook to DBModelUpdating event, and filter out update scripts that should not be applied, based on GlobalName of target model object.
Here's a quick sample how-to. Look at Extended UnitTests project, file SEtupHelper.cs, method InitApp. Find 'BooksApp.Init();' statement. Then add hooking to dbupdate event:
   //add this
    var dsService = BooksApp.GetService<IDataSourceManagementService>();
    dsService.Events.DbModelUpdating += Events_DbModelUpdating;
    //Now connect the main app
Now event handler:
static void Events_DbModelUpdating(object sender, DbModelUpdateEventArgs e) {
  foreach(var s in e.Scripts) {
    var objName = s.ModelChange.DbObject.GlobalName;
    if (objName.StartsWith("books.")) // Put check for Legacy object here
      s.Sql = "/* Script suppressed */";
the GlobalName is 'Schema.Table.Column', or 'Schema.IndexName', smth like that.
I will think about how to make this simpler for situation like yours
Dec 3, 2015 at 11:01 PM
there's another method - what if you create two EntityApps, one for legacy entities, one for import, connected to the same database? For Legacy app you disable db model update; you use Legacy app/sessions to load data only, then you create entities in import app, copy values there and save changes
Dec 4, 2015 at 6:35 PM
Both are already separate apps as they are both different databases. Its not a show stopper for me right now but more of a nice to have but will try your suggestion.