System.Data.Common.ADP.ConfigUnableToLoadXmlMetaDataFile(string)

Here are the examples of the csharp api class System.Data.Common.ADP.ConfigUnableToLoadXmlMetaDataFile(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: referencesource
Source File: AdapterUtil.cs
View license
[ResourceExposure(ResourceScope.Machine)]
        [ResourceConsumption(ResourceScope.Machine)]
        static internal Stream GetXmlStream(String value, String errorString) {
            Stream XmlStream;
            const string config = "config\\";
            // get location of config directory
            string rootPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
            if (rootPath == null) {
                    throw ADP.ConfigUnableToLoadXmlMetaDataFile(errorString);
            }
            StringBuilder tempstring = new StringBuilder(rootPath.Length+config.Length+value.Length);
            tempstring.Append(rootPath);
            tempstring.Append(config);
            tempstring.Append(value);
            String fullPath = tempstring.ToString();

            // don't allow relative paths
            if (ADP.GetFullPath(fullPath) != fullPath) {
                throw ADP.ConfigUnableToLoadXmlMetaDataFile(errorString);
            }

            try {
                XmlStream = ADP.GetFileStream(fullPath);
            }
            catch(Exception e){
                // 
                if (!ADP.IsCatchableExceptionType(e)) {
                    throw;
                }
                throw ADP.ConfigUnableToLoadXmlMetaDataFile(errorString);
            }

            return XmlStream;

        }