Пример #1
0
        public void DataProviderNode()
        {
            TestingConfiguration config = new TestingConfiguration();

            config.Load("desktop");

            DataProviderNode node = config.DataProviderNodes["NohrosDataProvider"] as DataProviderNode;

            Assert.AreEqual("NohrosDataProvider", node.Name);
            Assert.AreEqual("Nohros.Data.SqlNohrosDataProvider, nohros.data", node.Type);
            Assert.AreEqual(config.Location, node.Location);
            Assert.AreEqual("SQLSERVER", node.ConnectionString);
            Assert.AreEqual("dbo", node.DatabaseOwner);
            Assert.AreEqual(DataSourceType.MsSql, node.DataSourceType);
        }
Пример #2
0
 /// <summary>
 /// Creates an instance of the type designated by the specified
 /// <paramref name="provider"/> object using a constructor with the
 /// following signature:
 ///   .ctor(string database_owner, string connection_string);
 /// </summary>
 /// <param name="provider">A <see cref="DataProviderNode"/> object that
 /// contains informations such the connection string, the database owner,
 /// etc; that will be used to creates the designated provider instance.
 /// </param>
 /// <returns>A reference to the newly created object.</returns>
 /// <remarks>
 /// <para>
 /// The connection string and database owner parameters passed to the
 /// constructor will be extracted from the specified
 /// <paramref name="provider"/> object.
 /// </para>
 /// <para>
 /// The type defined by the <paramref name="provider"/> object must have
 /// a constructor that accepts two strings as parameters. The first
 /// parameter will be set to the provider database owner and the second
 /// parameter will be set to the provider connection string.
 /// </para>
 /// <para>The <see cref="ProviderNode.AssemblyLocation"/> will be used as
 /// a search location for assemblies that need to be loaded in order to
 /// create the desired provider instance.
 /// </para>
 /// </remarks>
 /// <exception cref="ArgumentNullException">provider is null.
 /// </exception>
 /// <exception cref="ProviderException">The type could not be created.
 /// </exception>
 protected static IDataProvider CreateDataProvider(
     DataProviderNode provider)
 {
     return(CreateDataProvider(provider, provider.DatabaseOwner,
                               provider.ConnectionString));
 }
Пример #3
0
 /// <summary>
 /// Creates an instance of the <see cref="IDataProvider"/> class by using
 /// the specified <paramref name="provider"/> object and a list of
 /// constructor arguments.
 /// </summary>
 /// <param name="provider">A <see cref="ProviderNode"/>
 /// object that contains information about the class that should be
 /// instantiated.</param>
 /// <param name="args">An array of arguments that match in number, order,
 /// and type the parameters of the constructor to invoke. If args is an
 /// empty array or null, the constructor that takes no parameters(the
 /// default constructor) is invoked.</param>
 /// <remarks>
 /// <para>The <see cref="ProviderNode.AssemblyLocation"/> will be used as
 /// a search location for assemblies that need to be loaded in order to
 /// create the desired provider instance.
 /// </para>
 /// </remarks>
 /// <returns>An object that implements the <see cref="IDataProvider"/>
 /// interface and has the same type that is defined by the
 /// <paramref name="provider"/> object.</returns>
 /// <exception cref="ArgumentNullException">provider is null.
 /// </exception>
 /// <exception cref="ProviderException">The type could not be created.
 /// </exception>
 protected static IDataProvider CreateDataProvider(
     DataProviderNode provider, params object[] args)
 {
     return(ProviderHelper.CreateFromProviderNode <IDataProvider>(
                provider, args));
 }