//--------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- namespace System.Data.Metadata.Edm { using System.Collections.Generic; using System.Globalization; /// /// Internal helper class for query /// internal class ModelPerspective : Perspective { #region Contructors /// /// Creates a new instance of perspective class so that query can work /// ignorant of all spaces /// /// runtime metadata container internal ModelPerspective(MetadataWorkspace metadataWorkspace) : base(metadataWorkspace, DataSpace.CSpace) { } #endregion #region Methods /// /// Look up a type in the target data space based upon the fullName /// /// fullName /// true for case-insensitive lookup /// The type usage object to return /// True if the retrieval succeeded internal override bool TryGetTypeByName(string fullName, bool ignoreCase, out TypeUsage typeUsage ) { EntityUtil.CheckStringArgument(fullName, "fullName"); typeUsage = null; EdmType edmType = null; if (this.MetadataWorkspace.TryGetItem(fullName, ignoreCase, this.TargetDataspace, out edmType)) { if (Helper.IsPrimitiveType(edmType)) { typeUsage = this.MetadataWorkspace.GetCanonicalModelTypeUsage(((PrimitiveType)edmType).PrimitiveTypeKind); } else { typeUsage = TypeUsage.Create(edmType); } } return typeUsage != null; } #endregion } }