Пример #1
0
        internal static void AddDatabases(
            IDictionary <string, PublishSettingsDatabase> databases,
            XPathNavigator nav)
        {
            if (nav.MoveToFirstChild())
            {
                do
                {
                    if (string.Equals(nav.Name, "add", StringComparison.OrdinalIgnoreCase))
                    {
                        PublishSettingsDatabase database = new PublishSettingsDatabase()
                        {
                            Name                = nav.GetAttribute("name", string.Empty),
                            ConnectionString    = nav.GetAttribute("connectionString", string.Empty),
                            ProviderName        = nav.GetAttribute("providerName", string.Empty),
                            Type                = nav.GetAttribute("type", string.Empty),
                            TargetDatabase      = nav.GetAttribute("targetDatabaseEngineType", string.Empty),
                            TargetServerVersion = nav.GetAttribute("targetServerVersion", string.Empty)
                        };

                        if (string.IsNullOrEmpty(database.Name))
                        {
                            throw new XmlException("Database 'add' element must contain a 'Name' attribute");
                        }

                        databases.Add(database.Name, database);
                    }
                }while (nav.MoveToNext());

                // Move back to the databases node
                nav.MoveToParent();
            }
        }
Пример #2
0
        internal static void AddDatabases(
            IDictionary<string, PublishSettingsDatabase> databases,
            XPathNavigator nav)
        {
            if (nav.MoveToFirstChild())
            {
                do
                {
                    if (string.Equals(nav.Name, "add", StringComparison.OrdinalIgnoreCase))
                    {
                        PublishSettingsDatabase database = new PublishSettingsDatabase()
                        {
                            Name = nav.GetAttribute("name", string.Empty),
                            ConnectionString = nav.GetAttribute("connectionString", string.Empty),
                            ProviderName = nav.GetAttribute("providerName", string.Empty),
                            Type = nav.GetAttribute("type", string.Empty),
                            TargetDatabase = nav.GetAttribute("targetDatabaseEngineType", string.Empty),
                            TargetServerVersion = nav.GetAttribute("targetServerVersion", string.Empty)
                        };

                        if (string.IsNullOrEmpty(database.Name))
                        {
                            throw new XmlException("Database 'add' element must contain a 'Name' attribute");
                        }

                        databases.Add(database.Name, database);
                    }
                }
                while (nav.MoveToNext());

                // Move back to the databases node
                nav.MoveToParent();
            }
        }