예제 #1
0
        public IsolationReview(ProcessTask processTask)
        {
            if (processTask == null)
            {
                throw new ArgumentNullException(nameof(processTask));
            }

            if (!processTask.IsPluginType() || processTask.ProcessTaskType != ProcessTaskType.MutilateDataTable ||
                processTask.Path != typeof(PrimaryKeyCollisionIsolationMutilation).FullName)
            {
                Error = "ProcessTask is not an isolation mutilation";
                return;
            }

            foreach (IArgument a in processTask.GetAllArguments())
            {
                try
                {
                    if (a.Name.Equals(nameof(PrimaryKeyCollisionIsolationMutilation.TablesToIsolate)))
                    {
                        TablesToIsolate = (TableInfo[])a.GetValueAsSystemType();
                    }
                    if (a.Name.Equals(nameof(PrimaryKeyCollisionIsolationMutilation.IsolationDatabase)))
                    {
                        IsolationDatabase = (ExternalDatabaseServer)a.GetValueAsSystemType();
                    }
                }
                catch (Exception e)
                {
                    Error = $"Bad Argument {a} : {e.Message}";
                    return;
                }
            }

            if (TablesToIsolate == null || TablesToIsolate.Length == 0)
            {
                Error = "No tables configured on Isolation task";
                return;
            }

            if (IsolationDatabase != null)
            {
                return;
            }
            Error = "No isolation database configured on Isolation task";
        }