public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { this.element = this.store.ElementFactory.CreateElement<ElementSchema>(); }); validationContext = new ValidationContext(ValidationCategories.Save, this.element); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { this.element = this.store.ElementFactory.CreateElement <ElementSchema>(); }); validationContext = new ValidationContext(ValidationCategories.Save, this.element); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { this.element = this.store.ElementFactory.CreateElement<ElementSchema>(); }); this.store.TransactionManager.DoWithinTransaction(() => { this.element.BaseId = TestBaseId; }); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { this.element = this.store.ElementFactory.CreateElement <ElementSchema>(); }); this.store.TransactionManager.DoWithinTransaction(() => { this.element.BaseId = TestBaseId; }); }
/// <summary> /// Applies the design-time policy to the given element properties. /// </summary> private static PropertyDescriptorCollection ApplyDesignPolicy(NamedElementSchema element, IEnumerable<PropertyDescriptor> properties) { var descriptors = properties.ToDictionary(property => property.Name); if (element.IsInheritedFromBase) { // Add read-only attribute to the Name property of the element var nameProperty = descriptors[Reflector<CustomizableElementSchema>.GetProperty(elem => elem.Name).Name]; descriptors[nameProperty.Name] = new DelegatingPropertyDescriptor(nameProperty, new ReadOnlyAttribute(true)); } return new PropertyDescriptorCollection(descriptors.Values.ToArray()); }
/// <summary> /// Applies the design-time policy to the given element properties. /// </summary> private static PropertyDescriptorCollection ApplyDesignPolicy(NamedElementSchema element, IEnumerable <PropertyDescriptor> properties) { var descriptors = properties.ToDictionary(property => property.Name); if (element.IsInheritedFromBase) { // Add read-only attribute to the Name property of the element var nameProperty = descriptors[Reflector <CustomizableElementSchema> .GetProperty(elem => elem.Name).Name]; descriptors[nameProperty.Name] = new DelegatingPropertyDescriptor(nameProperty, new ReadOnlyAttribute(true)); } return(new PropertyDescriptorCollection(descriptors.Values.ToArray())); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { var patternModel = this.store.ElementFactory.CreateElement <PatternModelSchema>(); var pattern = patternModel.Create <PatternSchema>(); var view = pattern.Create <ViewSchema>(); this.element = view.Create <ElementSchema>(); }); this.store.TransactionManager.DoWithinTransaction(() => { this.Element.Name = TestName; }); }
/// <summary> /// Applies the design-time policy to the given element properties. /// </summary> private static PropertyDescriptorCollection ApplyDesignPolicy(ElementLink link, IEnumerable <PropertyDescriptor> properties) { var descriptors = properties.ToDictionary(property => property.Name); // Get the target role as a NamedElement NamedElementSchema targetElement = DomainRoleInfo.GetTargetRolePlayer(link) as NamedElementSchema; if (targetElement != null) { if (targetElement.IsInheritedFromBase) { // Add read-only attribute to the Cardinality property of the element (and its relationship to the owning parent element) string propertyName = Reflector <ViewHasElements> .GetProperty(rellie => rellie.Cardinality).Name; var cardinalityProperty = descriptors[propertyName]; descriptors[cardinalityProperty.Name] = new DelegatingPropertyDescriptor(cardinalityProperty, new ReadOnlyAttribute(true)); } } return(new PropertyDescriptorCollection(descriptors.Values.ToArray())); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { var patternModel = this.store.ElementFactory.CreateElement<PatternModelSchema>(); var pattern = patternModel.Create<PatternSchema>(); var view = pattern.Create<ViewSchema>(); this.element = view.Create<ElementSchema>(); }); this.store.TransactionManager.DoWithinTransaction(() => { this.Element.Name = TestName; }); }
public void WhenNameChanged_ThenDisplayNameTracksValue() { this.Element.WithTransaction <NamedElementSchema>(element => element.Name = TestName2); Assert.Equal(NamedElementSchema.MakePascalIntoWords(TestName2), this.Element.DisplayName); }