Ejemplo n.º 1
0
        /// <summary>
        /// Load options in restore plan
        /// </summary>
        internal static void UpdateOptionsInPlan(IRestoreDatabaseTaskDataObject restoreDataObject)
        {
            RestoreOptionFactory restoreOptionFactory = RestoreOptionFactory.Instance;


            foreach (var optionKey in optionNames)
            {
                restoreOptionFactory.SetValue(optionKey, restoreDataObject);
            }

            //After all options are set do a vaidation so any invalid option set to default
            foreach (var optionKey in optionNames)
            {
                string error = restoreOptionFactory.ValidateOption(optionKey, restoreDataObject);
                if (!string.IsNullOrEmpty(error))
                {
                    //TODO: we could send back the error message so client knows the option is set incorrectly
                }
            }
        }
Ejemplo n.º 2
0
        internal static Dictionary <string, RestorePlanDetailInfo> CreateRestorePlanOptions(IRestoreDatabaseTaskDataObject restoreDataObject)
        {
            Validate.IsNotNull(nameof(restoreDataObject), restoreDataObject);

            Dictionary <string, RestorePlanDetailInfo> options = new Dictionary <string, RestorePlanDetailInfo>();
            RestoreOptionFactory restoreOptionFactory          = RestoreOptionFactory.Instance;

            //Create the options using the current values
            foreach (var optionKey in optionNames)
            {
                var optionInfo = restoreOptionFactory.CreateOptionInfo(optionKey, restoreDataObject);
                options.Add(optionKey, optionInfo);
            }

            // After all options are set verify them all again to set the read only
            // Because some options can change the readonly mode of other options.( e.g Recovery state can affect StandBy to be readyonly)
            foreach (var optionKey in optionNames)
            {
                restoreOptionFactory.UpdateOption(optionKey, restoreDataObject, options[optionKey]);
            }
            return(options);
        }