Пример #1
0
        public void Pregenerated_views_are_found_for_EDMX_model()
        {
            var edmItemCollection   = new EdmItemCollection(new[] { XDocument.Parse(PregenContextEdmx.Csdl).CreateReader() });
            var storeItemCollection = new StoreItemCollection(new[] { XDocument.Parse(PregenContextEdmx.Ssdl).CreateReader() });

            IList <EdmSchemaError> errors;
            var storageMappingItemCollection = StorageMappingItemCollection.Create(
                edmItemCollection,
                storeItemCollection,
                new[] { XDocument.Parse(PregenContextEdmx.Msl).CreateReader() },
                null,
                out errors);

            var workspace = new MetadataWorkspace(
                () => edmItemCollection,
                () => storeItemCollection,
                () => storageMappingItemCollection);

            using (var context = new PregenContextEdmx(workspace))
            {
                var _ = context.Blogs.ToString(); // Trigger view loading

                Assert.True(PregenContextEdmxViews.View0Accessed);
                Assert.True(PregenContextEdmxViews.View1Accessed);
            }
        }
Пример #2
0
        public void Pregenerated_views_are_found_for_EDMX_model()
        {
            var edmItemCollection = new EdmItemCollection(new[] { XDocument.Parse(PregenContextEdmx.Csdl).CreateReader() });
            var storeItemCollection = new StoreItemCollection(new[] { XDocument.Parse(PregenContextEdmx.Ssdl).CreateReader() });

            IList<EdmSchemaError> errors;
            var storageMappingItemCollection = StorageMappingItemCollection.Create(
                edmItemCollection,
                storeItemCollection,
                new[] { XDocument.Parse(PregenContextEdmx.Msl).CreateReader() },
                null,
                out errors);

            var workspace = new MetadataWorkspace(
                () => edmItemCollection,
                () => storeItemCollection,
                () => storageMappingItemCollection);

            using (var context = new PregenContextEdmx(workspace))
            {
                var _ = context.Blogs.ToString(); // Trigger view loading

                Assert.True(PregenContextEdmxViews.View0Accessed);
                Assert.True(PregenContextEdmxViews.View1Accessed);
            }
        }