Represents constructor which may not have built metadata.
Example #1
0
        /// <summary>
        ///		Defines the unpacking context type.
        /// </summary>
        /// <param name="fields">The fields must be declared.</param>
        /// <param name="type">
        ///		The type definition of the unpacking context.
        ///		Note that this type will be existing property bag or generated private type.
        /// </param>
        /// <param name="constructor">
        ///		The constructor of the context.
        /// </param>
        public void DefineUnpackingContext(
            KeyValuePair <string, TypeDefinition>[] fields,
            out TypeDefinition type,
            out ConstructorDefinition constructor
            )
        {
            if (this.UnpackingContextType != null)
            {
#if DEBUG
                Contract.Assert(
                    this._lastUnpackingContextFields.Select(kv => kv.Key + ":" + kv.Value)
                    .SequenceEqual(fields.Select(kv => kv.Key + ":" + kv.Value)),
                    "Duplicated UnpackingContext registration."
                    );
#endif // DEBUG
                type        = this._unpackingContextDefinition.Key;
                constructor = this._unpackingContextDefinition.Value;
                return;
            }

#if DEBUG
            this._lastUnpackingContextFields = fields.ToArray();
#endif // DEBUG
            TConstruct parameterInUnpackValueMethods, parameterInSetValueMethods, parameterInCreateObjectFromContext;
            this.DefineUnpackingContextCore(fields, out type, out constructor, out parameterInUnpackValueMethods, out parameterInSetValueMethods, out parameterInCreateObjectFromContext);
            this.UnpackingContextInUnpackValueMethods      = parameterInUnpackValueMethods;
            this.UnpackingContextInSetValueMethods         = parameterInSetValueMethods;
            this.UnpackingContextInCreateObjectFromContext = parameterInCreateObjectFromContext;
            this._unpackingContextDefinition = new KeyValuePair <TypeDefinition, ConstructorDefinition>(type, constructor);
        }
Example #2
0
 /// <summary>
 ///		Defines the unpacking context type.
 /// </summary>
 /// <param name="fields">The fields must be declared.</param>
 /// <param name="type">
 ///		The type definition of the unpacking context.
 ///		Note that this type will be existing property bag or generated private type.
 /// </param>
 /// <param name="constructor">
 ///		The constructor of the context.
 /// </param>
 /// <param name="parameterInUnpackValueMethods">The <paramref name="type"/> typed parameter for unpacking operations.</param>
 /// <param name="parameterInSetValueMethods">The <paramref name="type"/> typed parameter for unpacking operations.</param>
 /// <param name="parameterInCreateObjectFromContext">The <paramref name="type"/> typed parameter for CreateObjectFromContext method.</param>
 protected abstract void DefineUnpackingContextCore(
     IList <KeyValuePair <string, TypeDefinition> > fields,
     out TypeDefinition type,
     out ConstructorDefinition constructor,
     out TConstruct parameterInUnpackValueMethods,
     out TConstruct parameterInSetValueMethods,
     out TConstruct parameterInCreateObjectFromContext
     );