public SqlConnection OpenConnection(ISQLConnectionCredentials ConnectionCredentials)
        {
            SqlConnection SqlConnection = new SqlConnection(ConnectionCredentials.ToString( ));

            _OpenSQLConnection(SqlConnection);

            return(SqlConnection);
        }
        public ISQLDatabase GetDatabaseData(ISQLConnectionCredentials ServerConnectionCredentials, String DatabaseName)
        {
            //IEnumerable<KeyValuePair<ISQLTableKey, ISQLTable>>
            //011010\SQL_2012_SP4

            ISQLDatabase Reuslt = new SQLDatabase(DatabaseName, new SQLServer(null, ServerConnectionCredentials));

            Reuslt.LoadData( );

            return(Reuslt);
        }
        private dynamic _GetSchema(ISQLConnectionCredentials _ConnectionCredentials, Enum _SchemaType, ISchemaRestrictions _SchemaRestrictions)
        {
            using (SqlConnection _SqlConnection = new SqlConnection(_ConnectionCredentials.ToString( )))
            {
                _OpenSQLConnection(_SqlConnection);

                //System.Diagnostics.Debug.WriteLine( $"{_SchemaType?.GetDescription( )} _ { String.Join(", ", _SchemaRestrictions?.ToArray( ) ) }" );

                return((_SchemaRestrictions == null) ? _SqlConnection.GetSchema(_SchemaType.GetDescription( ))
                                                       : _SqlConnection.GetSchema(_SchemaType.GetDescription( ), _SchemaRestrictions.ToArray( )));
            }
        }
        public CP4SecurityServer(ISQLConnectionCredentials SQLConnectionCredentials, String Name, String SecurityDBName)
        {
            if (SQLConnectionCredentials == null)
            {
                throw new ArgumentNullException("SQLConnectionCredentials Cannot Be Null.");
            }

            if (String.IsNullOrWhiteSpace(Name))
            {
                throw new ArgumentOutOfRangeException("Server Name Cannot Be Null Or Whitespace.");
            }

            this.ConnectionCredentials = SQLConnectionCredentials;
            this.Name = Name;

            SecurityDB = new SQLDatabase(SecurityDBName, this);
        }
        public SQLConnectionCredentials(ISQLConnectionCredentials SQLConnectionCredentials, params String[] ConnectionStringAdditions)
        {
            String _BaseConnectionString = (SQLConnectionCredentials.ConnectionString.EndsWith(";")) ? SQLConnectionCredentials.ConnectionString.Substring(0, (SQLConnectionCredentials.ConnectionString.Length - 1))
                                                                                                       : SQLConnectionCredentials.ConnectionString;

            ConnectionString = _BaseConnectionString;

            foreach (String Addition in ConnectionStringAdditions)
            {
                ConnectionString = String.Join(";", ConnectionString, Addition);
            }

            Password = SQLConnectionCredentials.Password;
            Username = SQLConnectionCredentials.Username;
            EnableIntegratedSecurity = SQLConnectionCredentials.EnableIntegratedSecurity;
            PersistSecurityInfo      = SQLConnectionCredentials.PersistSecurityInfo;
        }
        public IEnumerable <String[]> ExecuteSQL(ISQLConnectionCredentials ConnectionCredentials, String Query)
        {
            if (Query == null)
            {
                yield break;
            }

            using (SqlConnection _SqlConnection = ConnectionManager.OpenConnection(ConnectionCredentials))
                using (SqlCommand _SqlCommand = new SqlCommand(Query, _SqlConnection))
                    using (SqlDataAdapter _SqlDataAdapter = new SqlDataAdapter(_SqlCommand))
                    {
                        DataSet _DataSet = new DataSet( );

                        _SqlDataAdapter.Fill(_DataSet);

                        for (int i = 0; i < _DataSet.Tables.Count; i++)
                        {
                            foreach (String[] _DataSetTableRow in _DataSet.Tables[i].GetDataRowValues( ))
                            {
                                yield return(_DataSetTableRow);
                            }
                        }
                    }
        }
 public dynamic GetSchema(ISQLConnectionCredentials ConnectionCredentials, Enum SchemaType, ISchemaRestrictions SchemaRestrictions = null)
 {
     return(_GetSchema(ConnectionCredentials, SchemaType, SchemaRestrictions));
 }
 public SqlConnection CreateConnection(ISQLConnectionCredentials ConnectionCredentials)
 {
     return(new SqlConnection(ConnectionCredentials.ToString( )));
 }
 public CRUDTestDBContextProvider(ISQLConnectionCredentials sQLConnectionCredentials)
 {
     this.sQLConnectionCredentials = sQLConnectionCredentials;
 }
 public SQLServer(String Name, ISQLConnectionCredentials SQLConnectionCredentials)
 {
     this.Name = Name;
     this.ConnectionCredentials = SQLConnectionCredentials;
 }