/// <summary>
        /// Construct FieldMetadata for structuralType.Members from TypeUsage
        /// </summary>
        internal DataRecordInfo(TypeUsage metadata)
        {
            Debug.Assert(null != metadata, "invalid attempt to instantiate DataRecordInfo with null metadata information");

            var structuralMembers = TypeHelpers.GetAllStructuralMembers(metadata);
            var fieldList = new FieldMetadata[structuralMembers.Count];
            for (var i = 0; i < fieldList.Length; ++i)
            {
                var member = structuralMembers[i];
                Debug.Assert(
                    (BuiltInTypeKind.EdmProperty == member.BuiltInTypeKind) ||
                    (BuiltInTypeKind.AssociationEndMember == member.BuiltInTypeKind),
                    "unexpected BuiltInTypeKind for member");
                fieldList[i] = new FieldMetadata(i, member);
            }
            _fieldMetadata = new ReadOnlyCollection<FieldMetadata>(fieldList);
            _metadata = metadata;
        }
예제 #2
0
        /// <summary>
        ///     Construct FieldMetadata for structuralType.Members from TypeUsage
        /// </summary>
        internal DataRecordInfo(TypeUsage metadata)
        {
            DebugCheck.NotNull(metadata);

            var structuralMembers = TypeHelpers.GetAllStructuralMembers(metadata);
            var fieldList         = new FieldMetadata[structuralMembers.Count];

            for (var i = 0; i < fieldList.Length; ++i)
            {
                var member = structuralMembers[i];
                Debug.Assert(
                    (BuiltInTypeKind.EdmProperty == member.BuiltInTypeKind) ||
                    (BuiltInTypeKind.AssociationEndMember == member.BuiltInTypeKind),
                    "unexpected BuiltInTypeKind for member");
                fieldList[i] = new FieldMetadata(i, member);
            }
            _fieldMetadata = new ReadOnlyCollection <FieldMetadata>(fieldList);
            _metadata      = metadata;
        }