Пример #1
0
        public ConnectionSettingsCollection ToSqlServerConnectionSettings()
        {
            //optimistic initialization (IsValid = true)
            ConnectionSettingsCollection list = new ConnectionSettingsCollection()
            {
                IsValid = true
            };

            foreach (DatabaseInstance i in this.DatabaseInstance)
            {
                foreach (Database db in i.Database)
                {
                    SqlServerConnectionSettings cs = new SqlServerConnectionSettings()
                    {
                        Instance = i.Name,
                        Database = db.Name
                    };

                    cs.Validate();
                    if (!cs.IsValid)
                    {
                        list.IsValid = false;
                    }

                    list.Add(cs);
                }
            }

            if (list.Count == 0)
            {
                list.IsValid = false;
            }

            return(list);
        }
Пример #2
0
        public ConnectionSettingsCollection ToOracleConnectionSettings()
        {
            //optimistic initialization (IsValid = true)
            ConnectionSettingsCollection list = new ConnectionSettingsCollection()
            {
                IsValid = true
            };

            foreach (DatabaseInstance i in this.DatabaseInstance)
            {
                foreach (Database db in i.Database)
                {
                    OracleConnectionSettings cs = new OracleConnectionSettings()
                    {
                        Instance = i.Name,
                        Database = db.Name,
                        //Schema = db.Schema.Name,
                        Port = i.PortNumber
                    };
                    foreach (string schema in db.Schema)
                    {
                        cs.Schema.Add(schema);
                    }


                    cs.Validate();
                    if (!cs.IsValid)
                    {
                        list.IsValid = false;
                    }

                    list.Add(cs);
                }
            }

            if (list.Count == 0)
            {
                list.IsValid = false;
            }

            return(list);
        }