Ejemplo n.º 1
0
        public static void AddSafely(this EditorContract contract, ContractForm form, ContractFormField field)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }

            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            //form.Fields.Add(field);
            form.WithMigrator(contract.GetMigrator()).AddField(field);
        }
Ejemplo n.º 2
0
        public static void RemoveSafely(this EditorContract contract, ContractForm form, ContractFormField field)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }

            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            //Remove all risks
            contract.AnalyzeIntegrityOf(form, field).ResolveDeleteRisks();

            //Remove this
            //form.Fields.Remove(field);
            form.WithMigrator(contract.GetMigrator()).RemoveField(field);
        }