Example #1
0
        public void Handle(EnumerateObjectsInDatabaseMessage dbMessage)
        {
            Contract.Requires(dbMessage != null, "dbMessage is null");
            Contract.Requires(dbMessage.DBObjects != null, "dbMessage.DBObjects is null");

            var newDBObjects            = dbMessage.DBObjects;
            var connectionForNewObjects = dbMessage.ConnectionViewModel;

            if (newDBObjects == null)
            {
                return;
            }
            lock (gawd)
            {
                foreach (var item in newDBObjects)
                {
                    // don't add it if it's already there
                    if (actualList.Any(dbo => dbo.SysObject.Equals(item)) == false)
                    {
                        var shell = IoC.Get <IShell>();
                        var newDBObjectViewModel = new DBObjectViewModel(item, connectionForNewObjects, eventAgg, shell);
                        actualList.Add(newDBObjectViewModel);
                    }
                }
            }
            ExecuteFilter();
        }
Example #2
0
        private async static Task <ScriptedObjectInfo> GetScriptedObject(DBObjectViewModel vm)
        {
            var ctx = new Data.SchemaDBContext(vm.ConnectionViewModel);
            var objectDefinition = await ctx.GetObjectDefinition(vm.SysObject);

            var scriptedInfo = new ScriptedObjectInfo(objectDefinition, vm.SysObject);

            return(scriptedInfo);
        }
Example #3
0
 public static void ScriptTheObject(DBObjectViewModel vm)
 {
     vm.ScriptObject();
 }