public void GetEdmType_Returns_CachedInstance()
        {
            ClrTypeCache cache = new ClrTypeCache();
            IEdmModel    model = EdmCoreModel.Instance;

            IEdmTypeReference edmType1 = cache.GetEdmType(typeof(int), model);
            IEdmTypeReference edmType2 = cache.GetEdmType(typeof(int), model);

            Assert.NotNull(edmType1);
            Assert.Same(edmType1, edmType2);
        }
        public void GetEdmType_Returns_CachedInstance()
        {
            ClrTypeCache cache = new ClrTypeCache();
            IEdmModel model = EdmCoreModel.Instance;

            IEdmTypeReference edmType1 = cache.GetEdmType(typeof(int), model);
            IEdmTypeReference edmType2 = cache.GetEdmType(typeof(int), model);

            Assert.NotNull(edmType1);
            Assert.Same(edmType1, edmType2);
        }
        internal static ClrTypeCache GetTypeMappingCache(this IEdmModel model)
        {
            Contract.Assert(model != null);

            ClrTypeCache typeMappingCache = model.GetAnnotationValue<ClrTypeCache>(model);
            if (typeMappingCache == null)
            {
                typeMappingCache = new ClrTypeCache();
                model.SetAnnotationValue(model, typeMappingCache);
            }

            return typeMappingCache;
        }