//For MetadataArtifactLoader.CreateCompositeFromFilePaths method call but we do not create the file paths in this method
        public EdmItemCollection(params string[] filePaths)
            : base(DataSpace.CSpace)
        {
            Check.NotNull(filePaths, "filePaths");

            // Wrap the file paths in instances of the MetadataArtifactLoader class, which provides
            // an abstraction and a uniform interface over a diverse set of metadata artifacts.
            //
            MetadataArtifactLoader composite = null;
            List <XmlReader>       readers   = null;

            try
            {
                composite = MetadataArtifactLoader.CreateCompositeFromFilePaths(filePaths, XmlConstants.CSpaceSchemaExtension);
                readers   = composite.CreateReaders(DataSpace.CSpace);
                Init(
                    readers,
                    composite.GetPaths(DataSpace.CSpace),
                    true /*throwOnError*/);
            }
            finally
            {
                if (readers != null)
                {
                    Helper.DisposeXmlReaders(readers);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Data.Entity.Core.Metadata.Edm.EdmItemCollection" /> class by using the paths where the conceptual schema definition language (CSDL) files exist.
        /// </summary>
        /// <param name="filePaths">The paths where the conceptual schema definition language (CSDL) files exist.</param>
        public EdmItemCollection(params string[] filePaths)
            : base(DataSpace.CSpace)
        {
            Check.NotNull <string[]>(filePaths, nameof(filePaths));
            List <XmlReader> xmlReaderList = (List <XmlReader>)null;

            try
            {
                MetadataArtifactLoader compositeFromFilePaths = MetadataArtifactLoader.CreateCompositeFromFilePaths((IEnumerable <string>)filePaths, ".csdl");
                xmlReaderList = compositeFromFilePaths.CreateReaders(DataSpace.CSpace);
                this.Init((IEnumerable <XmlReader>)xmlReaderList, (IEnumerable <string>)compositeFromFilePaths.GetPaths(DataSpace.CSpace), true);
            }
            finally
            {
                if (xmlReaderList != null)
                {
                    Helper.DisposeXmlReaders((IEnumerable <XmlReader>)xmlReaderList);
                }
            }
        }
Exemplo n.º 3
0
        //For MetadataArtifactLoader.CreateCompositeFromFilePaths method call but we do not create the file paths in this method
        public StoreItemCollection(params string[] filePaths)
            : base(DataSpace.SSpace)
        {
            Check.NotNull(filePaths, "filePaths");
            IEnumerable <string> enumerableFilePaths = filePaths;

            EntityUtil.CheckArgumentEmpty(ref enumerableFilePaths, Strings.StoreItemCollectionMustHaveOneArtifact, "filePaths");

            // Wrap the file paths in instances of the MetadataArtifactLoader class, which provides
            // an abstraction and a uniform interface over a diverse set of metadata artifacts.
            //
            MetadataArtifactLoader composite = null;
            List <XmlReader>       readers   = null;

            try
            {
                composite = MetadataArtifactLoader.CreateCompositeFromFilePaths(enumerableFilePaths, XmlConstants.SSpaceSchemaExtension);
                readers   = composite.CreateReaders(DataSpace.SSpace);
                var ieReaders = readers.AsEnumerable();
                EntityUtil.CheckArgumentEmpty(ref ieReaders, Strings.StoreItemCollectionMustHaveOneArtifact, "filePaths");

                Init(
                    readers,
                    composite.GetPaths(DataSpace.SSpace), /* throwOnError */ true, /* resolver */ null,
                    out _providerManifest,
                    out _providerFactory,
                    out _providerInvariantName,
                    out _providerManifestToken,
                    out _cachedCTypeFunction);
            }
            finally
            {
                if (readers != null)
                {
                    Helper.DisposeXmlReaders(readers);
                }
            }
        }
 public static MetadataArtifactLoader CreateCompositeFromFilePaths(
     IEnumerable <string> filePaths,
     string validExtension)
 {
     return(MetadataArtifactLoader.CreateCompositeFromFilePaths(filePaths, validExtension, (MetadataArtifactAssemblyResolver) new DefaultAssemblyResolver()));
 }