public SafetyRulesViewModel(IBindingList model, AcmaSchemaMapping mapping) : base() { this.model = model; this.SetCollectionViewModel(model, t => this.ViewModelResolver(t)); this.Commands.AddItem("Add", t => this.ShowCreateWindow()); this.mapping = mapping; }
protected override void ProcessRecord() { Global.ThrowIfNotConnected(this); try { AcmaSchemaMapping mapping = ActiveConfig.DB.GetMapping(this.Attribute, this.ObjectClass); ActiveConfig.DB.DeleteMapping(mapping); ActiveConfig.DB.ClearCache(); Console.WriteLine("Binding removed"); } catch (Exception ex) { ErrorRecord error = new ErrorRecord(ex, "UnknownError", ErrorCategory.NotSpecified, null); ThrowTerminatingError(error); } }