private void PrepareScopesForAdd() { var scopeNames = this.schema.Scopes.Split(AUCommon.Spliter, StringSplitOptions.RemoveEmptyEntries); foreach (string name in scopeNames) { AUAdminScope existingScope = AUCommon.FindMatchScope(this.existingUnitScopes, name); AUAdminScope inputScope = this.InputAdminScopes != null?AUCommon.FindMatchScope(this.InputAdminScopes, name) : null; if (inputScope != null && existingScope != null && inputScope.ID != existingScope.ID) { throw new AUObjectException(string.Format("导入的管理范围{0}与现有管理范围{1}的ID不一致,导致无法继续执行导入。", inputScope.ID, existingScope.ID)); } if (existingScope == null) { if (inputScope == null) { inputScope = new AUAdminScope() { ID = UuidHelper.NewUuidString(), ScopeSchemaType = name } } ; pendingActions.Add(new AddMemberAction((AdminUnit)this.Data, inputScope)); } else if (existingScope.Status != SchemaObjectStatus.Normal) { pendingActions.Add(new EnableMemberAction((AdminUnit)this.Data, existingScope)); } } }