/// <summary>
        /// Search for a Mapping metadata with the specified type key.
        /// </summary>
        /// <param name="item"></param>
        internal virtual Map GetMap(GlobalItem item)
        {
            //Contract.Requires(item != null);

            //will only be implemented by Mapping Item Collections
            throw Error.NotSupported();
        }
Пример #2
0
 internal static bool IsCollectionType(GlobalItem item)
 {
     return (BuiltInTypeKind.CollectionType == item.BuiltInTypeKind);
 }
        /// <summary>
        /// Verification code invoked for types
        /// </summary>
        /// <param name="item">The type being generated</param>
        internal void VerifyLanguageCaseSensitiveCompatibilityForType(GlobalItem item)
        {
            if (_isLanguageCaseSensitive)
            {
                return; // no validation necessary
            }

            try
            {
                _edmItemCollection.GetItem<GlobalItem>(
                                                        item.Identity,
                                                        true   // ignore case
                                                    );
            }
            catch (InvalidOperationException)
            {
                AddError(Strings.ItemExistsWithDifferentCase(item.BuiltInTypeKind.ToString(), item.Identity), ModelBuilderErrorCode.IncompatibleSettingForCaseSensitiveOption,
                    EdmSchemaErrorSeverity.Error, item.Identity);
            }
        }
Пример #4
0
        /// <summary>
        /// Gets the accessibility that should be applied to a type being generated from the provided GlobalItem.
        ///
        /// defaults to public if no annotation is found.
        /// </summary>
        public static string ForType(GlobalItem item)
        {
            if (item == null)
            {
                return null;
            }

            return GetAccessibility(item, TYPE_ACCESS);
        }
Пример #5
0
 internal static bool IsCollectionType(GlobalItem item)
 {
     return(BuiltInTypeKind.CollectionType == item.BuiltInTypeKind);
 }
Пример #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="typeSource">The source of the event</param>
 /// <param name="baseType">The base type of the type being generated</param>
 public TypeGeneratedEventArgs(GlobalItem typeSource, CodeTypeReference baseType)
 {
     this._typeSource = typeSource;
     this._baseType = baseType;
 }
        private bool ContainsMap(GlobalItem cspaceItem, out ObjectTypeMapping map)
        {
            Debug.Assert(cspaceItem.DataSpace == DataSpace.CSpace, "ContainsMap: It must be a CSpace item");
            int index;
            if (cdmTypeIndexes.TryGetValue(cspaceItem.Identity, out index))
            {
                map = (ObjectTypeMapping)this[index];
                return true;
            }

            map = null;
            return false;
        }
 /// <summary>
 /// Search for a Mapping metadata with the specified type key.
 /// </summary>
 /// <param name="item"></param>
 internal override Map GetMap(GlobalItem item)
 {
     var typeSpace = item.DataSpace;
     if (typeSpace != DataSpace.CSpace)
     {
         throw new InvalidOperationException(Strings.Mapping_Storage_InvalidSpace(typeSpace));
     }
     return GetMap(item.Identity, typeSpace);
 }
 /// <summary>
 /// Search for a Mapping metadata with the specified type key.
 /// </summary>
 /// <param name="item"></param>
 internal override Map GetMap(GlobalItem item)
 {
     EntityUtil.CheckArgumentNull(item, "item");
     Map map;
     if (!this.TryGetMap(item, out map))
     {
         throw new InvalidOperationException(System.Data.Entity.Strings.Mapping_Object_InvalidType(item.Identity));
     }
     return map;
 }
 /// <summary>
 /// Search for a Mapping metadata with the specified type key.
 /// </summary>
 /// <param name="item"></param>
 internal override Map GetMap(GlobalItem item)
 {
     Map map;
     if (!TryGetMap(item, out map))
     {
         throw new InvalidOperationException(Strings.Mapping_Object_InvalidType(item.Identity));
     }
     return map;
 }
Пример #11
0
 internal static bool IsEdmFunction(GlobalItem item)
 {
     return(BuiltInTypeKind.EdmFunction == item.BuiltInTypeKind);
 }
Пример #12
0
 internal static bool IsEntityContainer(GlobalItem item)
 {
     return(BuiltInTypeKind.EntityContainer == item.BuiltInTypeKind);
 }
Пример #13
0
 internal static bool IsRowType(GlobalItem item)
 {
     return(BuiltInTypeKind.RowType == item.BuiltInTypeKind);
 }
 /// <summary>
 /// Search for a Mapping metadata with the specified type key.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="map"></param>
 /// <returns>Returns false if no match found.</returns>
 internal override bool TryGetMap(GlobalItem item, out Map map)
 {
     if (item == null)
     {
         map = null;
         return false;
     }
     DataSpace typeSpace = item.DataSpace;
     if (typeSpace != DataSpace.CSpace)
     {
         map = null;
         return false;
     }
     return this.TryGetMap(item.Identity, typeSpace, out map);
 }
 /// <summary>
 /// Search for a Mapping metadata with the specified type key.
 /// </summary>
 /// <param name="item"></param>
 internal override Map GetMap(GlobalItem item)
 {
     EntityUtil.CheckArgumentNull(item, "item");
     DataSpace typeSpace = item.DataSpace;
     if (typeSpace != DataSpace.CSpace)
     {
         throw EntityUtil.InvalidOperation(System.Data.Entity.Strings.Mapping_Storage_InvalidSpace(typeSpace));
     }
     return this.GetMap(item.Identity, typeSpace);
 }
Пример #16
0
 internal static bool IsStoreType(GlobalItem item)
 {
     return item.DataSpace == DataSpace.SSpace;
 }
Пример #17
0
 /// <summary>
 /// Search for a Mapping metadata with the specified type key.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="map"></param>
 /// <returns>Returns false if no match found.</returns>
 internal virtual bool TryGetMap(GlobalItem item, out Map map)
 {
     //will only be implemented by Mapping Item Collections
     throw System.Data.Entity.Error.NotSupported();
 }
        /// <summary>
        /// Search for a Mapping metadata with the specified type key.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="map"></param>
        /// <returns>Returns false if no match found.</returns>
        internal override bool TryGetMap(GlobalItem item, out Map map)
        {
            if (item == null)
            {
                map = null;
                return false;
            }

            DataSpace typeSpace = item.DataSpace;

            //For transient types just create a map on fly and return
            EdmType edmType = item as EdmType;
            if (edmType != null)
            {
                if (Helper.IsTransientType(edmType))
                {
                    map = GetOCMapForTransientType(edmType, typeSpace);
                    if (map != null)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            return this.TryGetMap(item.Identity, typeSpace, out map);
        }