public virtual void SetAttributeValue(string attributeName, string xmlValue, bool isIdAttribute) { string oldValue = GetAttributeValue(attributeName); if (isIdAttribute) { _domElement.SetIdAttribute(attributeName, xmlValue); } else { _domElement.SetAttribute(attributeName, xmlValue); } IAttribute attribute = _elementType.GetAttribute(attributeName); if (attribute != null) { ((AttributeImpl)attribute).UpdateIncomingReferences(this, xmlValue, oldValue); } }
public virtual void PerformModelBuild(IModel model) { ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl)model.GetType(typeof(TTarget)); ModelElementTypeImpl referenceSourceType = (ModelElementTypeImpl)model.GetType(typeof(TSource)); ElementReferenceCollectionImpl.ReferenceTargetElementType = referenceTargetType; ElementReferenceCollectionImpl.SetReferenceSourceElementType(referenceSourceType); // the referenced attribute may be declared on a base type of the referenced type. AttributeImpl idAttribute = (AttributeImpl)referenceTargetType.GetAttribute("id"); if (idAttribute != null) { idAttribute.RegisterIncoming(ElementReferenceCollectionImpl); ElementReferenceCollectionImpl.ReferenceTargetAttribute = idAttribute; } else { throw new ModelException("Unable to find id attribute of " + typeof(TTarget)); } }
public virtual void PerformModelBuild(IModel model) { // register declaring type as a referencing type of referenced type ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl)model.GetType(typeof(T)); // the actual referenced type AttributeReferenceImpl.ReferenceTargetElementType = referenceTargetType; // the referenced attribute may be declared on a base type of the referenced type. AttributeImpl idAttribute = (AttributeImpl)referenceTargetType.GetAttribute("id"); if (idAttribute != null) { idAttribute.RegisterIncoming(AttributeReferenceImpl); AttributeReferenceImpl.ReferenceTargetAttribute = idAttribute; } else { throw new ModelException("XmlElement type " + referenceTargetType.TypeNamespace + ":" + referenceTargetType.TypeName + " has no id attribute"); } }