Esempio n. 1
0
        private static void Update(MSMO.FileGroup fileGroup, SQLInformation.Data.ApplicationDataSet.DBFileGroupsRow dataRow)
        {
            try
            {
                fileGroup.UpdateDataSet(dataRow);

                UpdateDatabaseWithSnapShot(dataRow, "");

                // Add the snapshot

                SMO.Helper.TakeDBFileGroupSnapShot(dataRow);

                // Add info about the DataFiles belonging to this filegroup.

                DataFile.LoadFromSMO(fileGroup, dataRow.ID, dataRow.Database_ID);
            }
            catch (Exception ex)
            {
                VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);

                UpdateDatabaseWithSnapShot(dataRow, ex.ToString().Substring(0, 256));
            }
        }
Esempio n. 2
0
        private static SQLInformation.Data.ApplicationDataSet.DBFileGroupsRow Add(MSMO.FileGroup fileGroup, Guid databaseID)
        {
            SQLInformation.Data.ApplicationDataSet.DBFileGroupsRow dataRow = null;

            try
            {
                dataRow = Common.ApplicationDataSet.DBFileGroups.NewDBFileGroupsRow();

                dataRow.ID             = Guid.NewGuid();
                dataRow.Database_ID    = databaseID;
                dataRow.Name_FileGroup = fileGroup.Name;
                dataRow.Size           = fileGroup.Size;

                Common.ApplicationDataSet.DBFileGroups.AddDBFileGroupsRow(dataRow);

                //fileGroupID = newFileGroup.ID;

                dataRow.SnapShotDate  = DateTime.Now;
                dataRow.SnapShotError = "";

                // Need to update before calling LoadDBDataFiles_FromSMO
                Common.ApplicationDataSet.DBFileGroupsTA.Update(Common.ApplicationDataSet.DBFileGroups);

                DataFile.LoadFromSMO(fileGroup, dataRow.ID, databaseID);
            }
            catch (Exception ex)
            {
                VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 5);
                // TODO(crhodes):
                // Wrap anything above that throws an exception that we want to ignore,
                // e.g. property not available because of SQL Edition.

                UpdateDatabaseWithSnapShot(dataRow, ex.ToString().Substring(0, 256));
            }

            return(dataRow);
        }