Beispiel #1
0
        /// <summary>
        /// See <see cref="System.Attribute.Equals"/>.
        /// </summary>
        public override bool Equals(object obj)
        {
            BoxedValueAttribute other = obj as BoxedValueAttribute;

            if (other == null)
            {
                return(false);
            }
            return(m_repositoryId != null ? m_repositoryId == other.m_repositoryId : other.m_repositoryId == null);
        }
Beispiel #2
0
        /// <summary>split the boxed representation of a boxedValueType into unboxed + attributes</summary>
        /// <remarks>
        /// attention: make sure, this is not called before all involved boxed types are completetly created;
        /// otherwise type couldn't be loaded from assembly?
        /// </remakrs>
        protected virtual void SplitBoxedForm(string boxedValueRepId)
        {
            Type separatedClsType = (Type)m_clsType.InvokeMember(BoxedValueBase.GET_FIRST_NONBOXED_TYPE_METHODNAME,
                                                                 BindingFlags.InvokeMethod | BindingFlags.Public |
                                                                 BindingFlags.NonPublic | BindingFlags.Static |
                                                                 BindingFlags.DeclaredOnly,
                                                                 null, null, new System.Object[0]);

            BoxedValueAttribute boxedValueAttr = new BoxedValueAttribute(boxedValueRepId);

            CustomAttributeBuilder[] separatedAttrsBuilder = new CustomAttributeBuilder[] {
                boxedValueAttr.CreateAttributeBuilder()
            };
            SetSeparated(separatedClsType, separatedAttrsBuilder,
                         new object[] { boxedValueAttr });
        }
        /// <summary>split the boxed representation of a boxedValueType into unboxed + attributes</summary>
        /// <remarks>
        /// attention: make sure, this is not called before all involved boxed types are completetly created; 
        /// otherwise type couldn't be loaded from assembly?
        /// </remakrs>
        protected override void SplitBoxedForm(string boxedValueRepId) {
            string separatedClsTypeName = (string)GetCompactClsType().InvokeMember(BoxedValueBase.GET_FIRST_NONBOXED_TYPENAME_METHODNAME,
                                                                          BindingFlags.InvokeMethod | BindingFlags.Public |
                                                                          BindingFlags.NonPublic | BindingFlags.Static |
                                                                          BindingFlags.DeclaredOnly,
                                                                          null, null, new System.Object[0]);


            // check, if separatedClsTypeName is in Consturction
            Type separatedClsType = m_typeManager.GetTypeFromBuildModule(separatedClsTypeName);
            if (separatedClsType != null) {
                // this prevents possible TypeLoadException, when separated is not fully defined,
                // thrown by base implementation
                BoxedValueAttribute boxAttr = new BoxedValueAttribute(boxedValueRepId);
                CustomAttributeBuilder[] separatedAttrs = new CustomAttributeBuilder[] { 
                    boxAttr.CreateAttributeBuilder() };
                
                SetSeparated(separatedClsType, separatedAttrs, new object[] { boxAttr });
            } else {
                // not know by ModuleBuilder -> possibly in an extern assembly -> load type directly instead of byName
                base.SplitBoxedForm(boxedValueRepId);
            }
        }
 public object read_boxed(BoxedValueAttribute attr, Type boxedType, AttributeExtCollection boxedTypeAttrs) {
     if (boxedTypeAttrs == null) {
         boxedTypeAttrs = AttributeExtCollection.EmptyCollection;
     }
     boxedTypeAttrs = boxedTypeAttrs.MergeAttribute(attr);
     return Unmarshal(boxedType, boxedTypeAttrs, m_cdrIn);
 }
 public void write_boxed(object val, BoxedValueAttribute attr) {
     Marshal(val.GetType(),
             new AttributeExtCollection(new Attribute[] { attr } ),
             val, m_cdrOut);
 }
 /// <summary>split the boxed representation of a boxedValueType into unboxed + attributes</summary>
 /// <remarks>
 /// attention: make sure, this is not called before all involved boxed types are completetly created; 
 /// otherwise type couldn't be loaded from assembly?
 /// </remakrs>
 protected virtual void SplitBoxedForm(string boxedValueRepId) {
     Type separatedClsType = (Type)m_clsType.InvokeMember(BoxedValueBase.GET_FIRST_NONBOXED_TYPE_METHODNAME,
                                                       BindingFlags.InvokeMethod | BindingFlags.Public |
                                                       BindingFlags.NonPublic | BindingFlags.Static |
                                                       BindingFlags.DeclaredOnly,
                                                       null, null, new System.Object[0]);
     
     BoxedValueAttribute boxedValueAttr = new BoxedValueAttribute(boxedValueRepId);
     CustomAttributeBuilder[] separatedAttrsBuilder = new CustomAttributeBuilder[] {
                             boxedValueAttr.CreateAttributeBuilder() };
     SetSeparated(separatedClsType, separatedAttrsBuilder, 
                  new object[] { boxedValueAttr } );
     
 }
 /// <summary>
 /// loads the boxed value type for the BoxedValueAttribute
 /// </summary>
 private static Type GetBoxedValueType(BoxedValueAttribute attr) {
     string repId = attr.RepositoryId; 
     Debug.WriteLine("getting boxed value type: " + repId);
     Type resultType = Repository.GetTypeForId(repId);
     return resultType;
 }