private TypeInfo ExplodeType(TypeUsage type) { if (TypeUtils.IsStructuredType(type)) { TypeInfo typeInfo = this.GetTypeInfo(type); this.ExplodeType(typeInfo); return(typeInfo); } if (!TypeUtils.IsCollectionType(type)) { return((TypeInfo)null); } this.ExplodeType(TypeHelpers.GetEdmType <CollectionType>(type).TypeUsage); return((TypeInfo)null); }
private void CreateTypeInfoForType(TypeUsage type) { while (TypeUtils.IsCollectionType(type)) { type = TypeHelpers.GetEdmType <CollectionType>(type).TypeUsage; } if (!TypeUtils.IsStructuredType(type)) { return; } ExplicitDiscriminatorMap discriminatorMap; this.TryGetDiscriminatorMap(type.EdmType, out discriminatorMap); this.CreateTypeInfoForStructuredType(type, discriminatorMap); }
// <summary> // "Explode" a type. (ie) produce a flat record type with one property for each // scalar property (top-level or nested) of the original type. // Really deals with structured types, but also // peels off collection wrappers // </summary> // <param name="type"> the type to explode </param> // <returns> the typeinfo for this type (with the explosion) </returns> private TypeInfo ExplodeType(md.TypeUsage type) { if (TypeUtils.IsStructuredType(type)) { var typeInfo = GetTypeInfo(type); ExplodeType(typeInfo); return(typeInfo); } if (TypeUtils.IsCollectionType(type)) { var elementType = TypeHelpers.GetEdmType <md.CollectionType>(type).TypeUsage; ExplodeType(elementType); return(null); } return(null); }
// <summary> // Create a TypeInfo (if necessary) for the type, and add it to the TypeInfo map // </summary> // <param name="type"> the type to process </param> private void CreateTypeInfoForType(md.TypeUsage type) { // // peel off all collection wrappers // while (TypeUtils.IsCollectionType(type)) { type = TypeHelpers.GetEdmType <md.CollectionType>(type).TypeUsage; } // Only add "structured" types if (TypeUtils.IsStructuredType(type)) { // check for discriminator map... ExplicitDiscriminatorMap discriminatorMap; TryGetDiscriminatorMap(type.EdmType, out discriminatorMap); CreateTypeInfoForStructuredType(type, discriminatorMap); } }