Esempio n. 1
0
        public static IEdmRowTypeReference AsRow(this IEdmTypeReference type)
        {
            EdmUtil.CheckArgumentNull <IEdmTypeReference>(type, "type");
            IEdmRowTypeReference edmRowTypeReference = type as IEdmRowTypeReference;

            if (edmRowTypeReference == null)
            {
                IEdmType definition = type.Definition;
                if (definition.TypeKind != EdmTypeKind.Row)
                {
                    List <EdmError> edmErrors = new List <EdmError>(type.Errors());
                    if (edmErrors.Count == 0)
                    {
                        edmErrors.AddRange(EdmTypeSemantics.ConversionError(type.Location(), type.FullName(), "Row"));
                    }
                    return(new EdmRowTypeReference(new BadRowType(edmErrors), type.IsNullable));
                }
                else
                {
                    return(new EdmRowTypeReference((IEdmRowType)definition, type.IsNullable));
                }
            }
            else
            {
                return(edmRowTypeReference);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// If this reference is of a row type, this will return a valid row type reference to the type definition. Otherwise, it will return a bad row type reference.
        /// </summary>
        /// <param name="type">Reference to the calling object.</param>
        /// <returns>A valid row type reference if the definition of the reference is of a row type. Otherwise a bad row type reference.</returns>
        public static IEdmRowTypeReference AsRow(this IEdmTypeReference type)
        {
            EdmUtil.CheckArgumentNull(type, "type");
            IEdmRowTypeReference reference = type as IEdmRowTypeReference;

            if (reference != null)
            {
                return(reference);
            }

            IEdmType typeDefinition = type.Definition;

            if (typeDefinition.TypeKind == EdmTypeKind.Row)
            {
                return(new EdmRowTypeReference((IEdmRowType)typeDefinition, type.IsNullable));
            }

            List <EdmError> errors = new List <EdmError>(type.Errors());

            if (errors.Count == 0)
            {
                errors.AddRange(ConversionError(type.Location(), type.FullName(), EdmConstants.Type_Row));
            }

            return(new EdmRowTypeReference(new BadRowType(errors), type.IsNullable));
        }
Esempio n. 3
0
 protected virtual void ProcessRowTypeReference(IEdmRowTypeReference reference)
 {
     this.ProcessStructuredTypeReference(reference);
     this.ProcessRowType(reference.RowDefinition());
 }