Esempio n. 1
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);
            }
        }
Esempio n. 3
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 } );
     
 }