/// <summary>
        /// <para>Adds an <see cref="ConnectionStringData"/> into the collection.</para>
        /// </summary>
        /// <param name="connectionStringData">
        /// <para>The <see cref="ConnectionStringData"/> to add. The value can not be a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// </param>
        /// <remarks>
        /// <para>If a reference already exists in the collection by <seealso cref="ConnectionStringData.Name"/>, it will be replaced with the new reference.</para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="connectionStringData"/> is a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// <para><seealso cref="ConnectionStringData.Name"/> is a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// </exception>
        public void Add(ConnectionStringData connectionStringData)
        {
            ArgumentValidation.CheckForNullReference(connectionStringData, "connectionStringData");
            ArgumentValidation.CheckForInvalidNullNameReference(connectionStringData.Name, typeof(ConnectionStringData).FullName);

            BaseAdd(connectionStringData.Name, connectionStringData);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseProviderData"/> class.
 /// </summary>
 /// <param name="instance">An <see cref="InstanceData"/> object.</param>
 /// <param name="type">A <see cref="DatabaseTypeData"/> object.</param>
 /// <param name="connectionString">A <see cref="ConnectionStringData"/> object.</param>
 public DatabaseProviderData(
     InstanceData instance,
     DatabaseTypeData type,
     ConnectionStringData connectionString)
     : this(instance.Name, type.TypeName, connectionString)
 {
 }
 /// <devdoc>
 /// Creates a connection string by reading a connectionString node from configuration.
 /// </devdoc>        
 public static string Build(ConnectionStringData connectionString)
 {
     StringBuilder connection = new StringBuilder();
     foreach (ParameterData setting in connectionString.Parameters)
     {
         connection.AppendFormat("{0}={1};", setting.Name, setting.Value);
     }
     return connection.ToString();
 }
        private static DatabaseSettings GenerateDataSettings()
        {
            DatabaseSettings settings = new DatabaseSettings();

            settings.DefaultInstance = "Service_Dflt";

            settings.DatabaseTypes.Add( new DatabaseTypeData("SqlServer", typeof(SqlDatabase).AssemblyQualifiedName));
            settings.DatabaseTypes.Add( new DatabaseTypeData("Oracle", typeof(OracleDatabase).AssemblyQualifiedName));

            ConnectionStringData data = new ConnectionStringData("OracleTest");
            data.Parameters.Add(new ParameterData("server","entlib"));
            data.Parameters.Add(new ParameterData("user id","testuser"));
            data.Parameters.Add(new ParameterData("password","testuser"));
            settings.ConnectionStrings.Add(data);

            data = new ConnectionStringData("NewDatabase");
            data.Parameters.Add(new ParameterData("server","localhost"));
            data.Parameters.Add(new ParameterData("database","Northwind"));
            data.Parameters.Add(new ParameterData("Integrated Security","true"));
            settings.ConnectionStrings.Add(data);

            data = new ConnectionStringData("DbWithSqlServerAuthn");
            data.Parameters.Add(new ParameterData("server","localhost"));
            data.Parameters.Add(new ParameterData("database","Northwind"));
            data.Parameters.Add(new ParameterData("uid","sa"));
            data.Parameters.Add(new ParameterData("pwd","mypassword"));
            settings.ConnectionStrings.Add(data);

            data = new ConnectionStringData("Northwind");
            data.Parameters.Add(new ParameterData("server","localhost"));
            data.Parameters.Add(new ParameterData("database","Northwind"));
            data.Parameters.Add(new ParameterData("Integrated Security","true"));
            settings.ConnectionStrings.Add(data);

            data = new ConnectionStringData("EntLibQuickStarts");
            data.Parameters.Add(new ParameterData("server","localhost"));
            data.Parameters.Add(new ParameterData("database","EntLibQuickStarts"));
            data.Parameters.Add(new ParameterData("Integrated Security","true"));
            settings.ConnectionStrings.Add(data);

            data = new ConnectionStringData("NorthwindPersistFalse");
            data.Parameters.Add(new ParameterData("server","localhost"));
            data.Parameters.Add(new ParameterData("database","Northwind"));
            data.Parameters.Add(new ParameterData("uid","entlib"));
            data.Parameters.Add(new ParameterData("pwd","sunrain"));
            data.Parameters.Add(new ParameterData("Persist Security Info", "false"));
            settings.ConnectionStrings.Add(data);

            settings.Instances.Add( new InstanceData("NewDatabase", "SqlServer", "NewDatabase"));
            settings.Instances.Add( new InstanceData("Service_Dflt", "SqlServer", "Northwind"));
            settings.Instances.Add( new InstanceData("EntLibQS", "SqlServer", "EntLibQuickStarts"));
            settings.Instances.Add( new InstanceData("DbWithSqlServerAuthn", "SqlServer", "DbWithSqlServerAuthn"));
            settings.Instances.Add( new InstanceData("NorthwindPersistFalse", "SqlServer", "NorthwindPersistFalse"));
            settings.Instances.Add( new InstanceData("OracleTest", "Oracle", "OracleTest"));

            return settings;
        }
        private static DatabaseSettings GenerateDataSettings()
        {
            DatabaseSettings settings = new DatabaseSettings();
            settings.DatabaseTypes.Add( new DatabaseTypeData("DB2", typeof(DB2Database).AssemblyQualifiedName));

            ConnectionStringData data = new ConnectionStringData("DB2Test");
            data.Parameters.Add(new ParameterData("server","entlib01"));
            data.Parameters.Add(new ParameterData("database","sample"));
            data.Parameters.Add(new ParameterData("user id","administrator"));
            data.Parameters.Add(new ParameterData("password","Pag$1Lab"));
            settings.ConnectionStrings.Add(data);

            settings.Instances.Add( new InstanceData("DB2Test", "DB2", "DB2Test"));
            return settings;
        }
        /// <summary>
        /// <para>Adds an <see cref="ConnectionStringData"/> into the collection.</para>
        /// </summary>
        /// <param name="connectionStringData">
        /// <para>The <see cref="ConnectionStringData"/> to add. The value can not be a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// </param>
        /// <remarks>
        /// <para>If a reference already exists in the collection by <seealso cref="ConnectionStringData.Name"/>, it will be replaced with the new reference.</para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="connectionStringData"/> is a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// <para><seealso cref="ConnectionStringData.Name"/> is a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// </exception>
        public void Add(ConnectionStringData connectionStringData)
        {
            ArgumentValidation.CheckForNullReference(connectionStringData, "connectionStringData");
            ArgumentValidation.CheckForInvalidNullNameReference(connectionStringData.Name, typeof(ConnectionStringData).FullName);

            BaseAdd(connectionStringData.Name, connectionStringData);
        }
 /// <summary>
 /// <para>Copies the entire <see cref="ConnectionStringData"/> to a compatible one-dimensional <see cref="Array"/>, starting at the specified index of the target array.</para>
 /// </summary>
 /// <param name="array">
 /// <para>The one-dimensional <see cref="ConnectionStringData"/> array that is the destination of the elements copied from <see cref="ConnectionStringDataCollection"/>. The <see cref="ConnectionStringData"/> array must have zero-based indexing.</para>
 /// </param>
 /// <param name="index">
 /// <para>The zero-based index in array at which copying begins.</para>
 /// </param>
 public void CopyTo(ConnectionStringData[] array, int index)
 {
     base.CopyTo(array, index);
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseProviderData"/> class.
 /// </summary>
 /// <param name="name">A name.</param>
 /// <param name="typeName">A type name of a class that implements the <see cref="Database"/> class.</param>
 /// <param name="connectionStringData">A <see cref="ConnectionStringData"/> object.</param>
 public DatabaseProviderData(string name, string typeName, ConnectionStringData connectionStringData) : base(name)
 {
     this.typeName             = typeName;
     this.connectionStringData = connectionStringData;
 }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseProviderData"/> class.
 /// </summary>
 /// <param name="instance">An <see cref="InstanceData"/> object.</param>
 /// <param name="type">A <see cref="DatabaseTypeData"/> object.</param>
 /// <param name="connectionString">A <see cref="ConnectionStringData"/> object.</param>
 public DatabaseProviderData(
     InstanceData instance,
     DatabaseTypeData type,
     ConnectionStringData connectionString) : this(instance.Name, type.TypeName, connectionString)
 {
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseProviderData"/> class.
 /// </summary>
 /// <param name="name">A name.</param>
 /// <param name="typeName">A type name of a class that implements the <see cref="Database"/> class.</param>
 /// <param name="connectionStringData">A <see cref="ConnectionStringData"/> object.</param>
 public DatabaseProviderData(string name, string typeName, ConnectionStringData connectionStringData)
     : base(name)
 {
     this.typeName = typeName;
     this.connectionStringData = connectionStringData;
 }