コード例 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="clrType">The Clr Type</param>
        /// <param name="edmTypeName">The Edm Type Name</param>
        /// <param name="primitiveKind">The Edm Primitive Type Kind</param>
        /// <param name="typeConverter">A PrimitiveXmlConverter that provides convertion between  instances of this type to its Xml representation and back</param>
        /// <param name="hasReverseMapping">Whether this primitive type can be mapped from the Edm type name</param>
        private PrimitiveType(Type clrType, string edmTypeName, EdmPrimitiveTypeKind primitiveKind, PrimitiveTypeConverter typeConverter, bool hasReverseMapping)
        {
            Debug.Assert(clrType != null, "clrType != null");
            Debug.Assert(primitiveKind != EdmPrimitiveTypeKind.None, "primitiveKind != EdmPrimitiveTypeKind.None");
            Debug.Assert(typeConverter != null, "typeConverter != null");

            this.ClrType           = clrType;
            this.EdmTypeName       = edmTypeName;
            this.PrimitiveKind     = primitiveKind;
            this.TypeConverter     = typeConverter;
            this.HasReverseMapping = hasReverseMapping;
        }
コード例 #2
0
ファイル: PrimitiveType.cs プロジェクト: larsenjo/odata.net
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="clrType">The Clr Type</param>
        /// <param name="edmTypeName">The Edm Type Name</param>
        /// <param name="primitiveKind">The Edm Primitive Type Kind</param>
        /// <param name="typeConverter">A PrimitiveXmlConverter that provides convertion between  instances of this type to its Xml representation and back</param>
        /// <param name="hasReverseMapping">Whether this primitive type can be mapped from the Edm type name</param>
        private PrimitiveType(Type clrType, string edmTypeName, EdmPrimitiveTypeKind primitiveKind, PrimitiveTypeConverter typeConverter, bool hasReverseMapping)
        {
            Debug.Assert(clrType != null, "clrType != null");
            Debug.Assert(primitiveKind != EdmPrimitiveTypeKind.None, "primitiveKind != EdmPrimitiveTypeKind.None");
            Debug.Assert(typeConverter != null, "typeConverter != null");

            this.ClrType = clrType;
            this.EdmTypeName = edmTypeName;
            this.PrimitiveKind = primitiveKind;
            this.TypeConverter = typeConverter;
            this.HasReverseMapping = hasReverseMapping;
        }
コード例 #3
0
        /// <summary>
        /// Register a known type as primitive type
        /// </summary>
        /// <param name="clrType">The Clr Type</param>
        /// <param name="edmTypeName">The Edm Type Name</param>
        /// <param name="primitiveKind">The Edm Primitive Type Kind</param>
        /// <param name="converter">The Type Converter</param>
        /// <param name="twoWay">Whether this mapping should have a reverse mapping from Edm</param>
        /// <remarks>
        /// This method is internal only for testing purposes.
        /// IN PRODUCT MUST BE CALLED ONLY FROM THE STATIC CTOR OF THE PrimitiveType CLASS.
        /// </remarks>
        internal static void RegisterKnownType(Type clrType, string edmTypeName, EdmPrimitiveTypeKind primitiveKind, PrimitiveTypeConverter converter, bool twoWay)
        {
            Debug.Assert(!clrMapping.ContainsKey(clrType), "Clr type already registered");
            Debug.Assert(clrType != null, "clrType != null");
            Debug.Assert(primitiveKind != EdmPrimitiveTypeKind.None, "primitiveKind != EdmPrimitiveTypeKind.None");
            Debug.Assert(converter != null, "converter != null");

            PrimitiveType pt = new PrimitiveType(clrType, edmTypeName, primitiveKind, converter, twoWay);

            clrMapping.Add(clrType, pt);

            if (twoWay)
            {
                Debug.Assert(!edmMapping.ContainsKey(edmTypeName), "Edm type name already registered");
                edmMapping.Add(edmTypeName, pt);
            }
        }
コード例 #4
0
ファイル: PrimitiveType.cs プロジェクト: larsenjo/odata.net
        /// <summary>
        /// Register a known type as primitive type
        /// </summary>
        /// <param name="clrType">The Clr Type</param>
        /// <param name="edmTypeName">The Edm Type Name</param>
        /// <param name="primitiveKind">The Edm Primitive Type Kind</param>
        /// <param name="converter">The Type Converter</param>
        /// <param name="twoWay">Whether this mapping should have a reverse mapping from Edm</param>
        /// <remarks>
        /// This method is internal only for testing purposes. 
        /// IN PRODUCT MUST BE CALLED ONLY FROM THE STATIC CTOR OF THE PrimitiveType CLASS.
        /// </remarks>
        internal static void RegisterKnownType(Type clrType, string edmTypeName, EdmPrimitiveTypeKind primitiveKind, PrimitiveTypeConverter converter, bool twoWay)
        {
            Debug.Assert(!clrMapping.ContainsKey(clrType), "Clr type already registered");
            Debug.Assert(clrType != null, "clrType != null");
            Debug.Assert(primitiveKind != EdmPrimitiveTypeKind.None, "primitiveKind != EdmPrimitiveTypeKind.None");
            Debug.Assert(converter != null, "converter != null");

            PrimitiveType pt = new PrimitiveType(clrType, edmTypeName, primitiveKind, converter, twoWay);
            clrMapping.Add(clrType, pt);

            if (twoWay)
            {
                Debug.Assert(!edmMapping.ContainsKey(edmTypeName), "Edm type name already registered");
                edmMapping.Add(edmTypeName, pt);
            }
        }