Exemplo n.º 1
0
 private IList <EdmSchemaError> Init(
     IEnumerable <XmlReader> xmlReaders,
     IEnumerable <string> filePaths,
     bool throwOnError,
     IDbDependencyResolver resolver,
     out DbProviderManifest providerManifest,
     out DbProviderFactory providerFactory,
     out string providerInvariantName,
     out string providerManifestToken,
     out Memoizer <EdmFunction, EdmFunction> cachedCTypeFunction)
 {
     cachedCTypeFunction = new Memoizer <EdmFunction, EdmFunction>(new Func <EdmFunction, EdmFunction>(StoreItemCollection.ConvertFunctionSignatureToCType), (IEqualityComparer <EdmFunction>)null);
     StoreItemCollection.Loader loader = new StoreItemCollection.Loader(xmlReaders, filePaths, throwOnError, resolver);
     providerFactory       = loader.ProviderFactory;
     providerManifest      = loader.ProviderManifest;
     providerManifestToken = loader.ProviderManifestToken;
     providerInvariantName = loader.ProviderInvariantName;
     if (!loader.HasNonWarningErrors)
     {
         this.LoadProviderManifest(loader.ProviderManifest);
         List <EdmSchemaError> edmSchemaErrorList = EdmItemCollection.LoadItems(this._providerManifest, loader.Schemas, (ItemCollection)this);
         foreach (EdmSchemaError edmSchemaError in edmSchemaErrorList)
         {
             loader.Errors.Add(edmSchemaError);
         }
         if (throwOnError && edmSchemaErrorList.Count != 0)
         {
             loader.ThrowOnNonWarningErrors();
         }
     }
     return(loader.Errors);
 }
Exemplo n.º 2
0
 private IList <EdmSchemaError> Init(
     IEnumerable <XmlReader> xmlReaders,
     IEnumerable <string> filePaths,
     bool throwOnError)
 {
     this.Init();
     return(EdmItemCollection.LoadItems(xmlReaders, filePaths, SchemaDataModelOption.EntityDataModel, (DbProviderManifest)MetadataItem.EdmProviderManifest, (ItemCollection)this, throwOnError));
 }
Exemplo n.º 3
0
        private IList <EdmSchemaError> Init(
            IEnumerable <XmlReader> xmlReaders,
            IEnumerable <string> filePaths,
            bool throwOnError,
            IDbDependencyResolver resolver,
            out DbProviderManifest providerManifest,
            out DbProviderFactory providerFactory,
            out string providerInvariantName,
            out string providerManifestToken,
            out Memoizer <EdmFunction, EdmFunction> cachedCTypeFunction)
        {
            DebugCheck.NotNull(xmlReaders);
            // 'filePaths' can be null

            cachedCTypeFunction = new Memoizer <EdmFunction, EdmFunction>(ConvertFunctionSignatureToCType, null);

            var loader = new Loader(xmlReaders, filePaths, throwOnError, resolver);

            providerFactory       = loader.ProviderFactory;
            providerManifest      = loader.ProviderManifest;
            providerManifestToken = loader.ProviderManifestToken;
            providerInvariantName = loader.ProviderInvariantName;

            // load the items into the collection
            if (!loader.HasNonWarningErrors)
            {
                LoadProviderManifest(loader.ProviderManifest /* check for system namespace */);
                var errorList = EdmItemCollection.LoadItems(_providerManifest, loader.Schemas, this);
                foreach (var error in errorList)
                {
                    loader.Errors.Add(error);
                }

                if (throwOnError && errorList.Count != 0)
                {
                    loader.ThrowOnNonWarningErrors();
                }
            }

            return(loader.Errors);
        }
Exemplo n.º 4
0
        internal static IList <EdmSchemaError> LoadItems(
            IEnumerable <XmlReader> xmlReaders,
            IEnumerable <string> sourceFilePaths,
            SchemaDataModelOption dataModelOption,
            DbProviderManifest providerManifest,
            ItemCollection itemCollection,
            bool throwOnError)
        {
            IList <Schema>         schemaCollection = (IList <Schema>)null;
            IList <EdmSchemaError> andValidate      = SchemaManager.ParseAndValidate(xmlReaders, sourceFilePaths, dataModelOption, providerManifest, out schemaCollection);

            if (MetadataHelper.CheckIfAllErrorsAreWarnings(andValidate))
            {
                foreach (EdmSchemaError loadItem in EdmItemCollection.LoadItems(providerManifest, schemaCollection, itemCollection))
                {
                    andValidate.Add(loadItem);
                }
            }
            if (!MetadataHelper.CheckIfAllErrorsAreWarnings(andValidate) && throwOnError)
            {
                throw EntityUtil.InvalidSchemaEncountered(Helper.CombineErrorMessage((IEnumerable <EdmSchemaError>)andValidate));
            }
            return(andValidate);
        }