SPRNET-1042 - Specify location of additional DbProvider definitions in Spring XML database namespace
This commit is contained in:
@@ -1235,7 +1235,7 @@ Commandline Examples:
|
||||
file="src/Spring/Spring.Aop/Aop/Config/spring-aop-1.1.xsd"/>
|
||||
|
||||
<copy todir="${current.package.dir}/doc/schema"
|
||||
file="src/Spring/Spring.Data/Data/Config/spring-database-1.1.xsd"/>
|
||||
file="src/Spring/Spring.Data/Data/Config/spring-database-1.3.xsd"/>
|
||||
|
||||
<copy todir="${current.package.dir}/doc/schema"
|
||||
file="src/Spring/Spring.Data/Transaction/Config/spring-tx-1.1.xsd"/>
|
||||
|
||||
@@ -355,17 +355,20 @@
|
||||
|
||||
<para>The default definitions of the providers are contained in the
|
||||
assembly resource
|
||||
<code>assembly://Spring.Data/Spring.Data.Common/dbproviders.xml</code>.
|
||||
Future additions to round out the database coverage are forthcoming. The
|
||||
current crude mechanism to add additional providers, or to apply any
|
||||
standard Spring <literal>IApplicationContext</literal> functionality, such
|
||||
as applying AOP advice, is to set the public static property
|
||||
<code>assembly://Spring.Data/Spring.Data.Common/dbproviders.xml</code>. If
|
||||
the provider you want to use is not provided "out of the box" you can
|
||||
provide additional definitions. To do this follow the format of object
|
||||
definitions defined in the previously mentioned assembly resource.</para>
|
||||
|
||||
<para>From Spring 1.3.1 an on you can specify the additional Spring
|
||||
IResource location where additional providers are defined within Spring's
|
||||
XML configuration file. See the next section for an example.
|
||||
Alternatively, you can set the public static property
|
||||
DBPROVIDER_ADDITIONAL_RESOURCE_NAME in
|
||||
<literal>DbProviderFactory</literal> to a Spring resource location. The
|
||||
default value is <code>file://dbProviders.xml</code>. (That isn't a typo,
|
||||
there is a difference in case with the name of the embedded resource).
|
||||
This crude mechanism will eventually be replaced with one based on a
|
||||
custom configuration section in App.config/Web.config.</para>
|
||||
there is a difference in case with the name of the embedded
|
||||
resource).</para>
|
||||
|
||||
<para>It may happen that the version number of an assembly you have
|
||||
downloaded is different than the one listed above. If it is a point
|
||||
@@ -403,6 +406,27 @@
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
</object>
|
||||
|
||||
</objects></programlisting>
|
||||
|
||||
<para>If you need to register an additional IDbProvider defintions from
|
||||
your own configuration file, set the attribute 'additonalDbProviders' to
|
||||
the IResource location of those definitions. Examples of the format for
|
||||
additional provider definitions can be found within the Spring.Data
|
||||
assembly, location
|
||||
<code>assembly://Spring.Data/Spring.Data.Common/dbproviders.xml</code>.
|
||||
Open it up in Visual Studio or Reflector to see the contents of the
|
||||
dbproviders.xml file.</para>
|
||||
|
||||
<programlisting language="myxml"><objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
<emphasis role="bold"><db:additionalProviders resource="assembly://MyAssembly/MyAssembly.MyNamespace/AdditionalProviders.xml"/></emphasis>
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="System.Data.SqlClient"
|
||||
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
|
||||
</objects></programlisting>
|
||||
|
||||
<para>A custom namespace should be registered in the main application
|
||||
|
||||
@@ -247,7 +247,6 @@ namespace Spring.Core.IO
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
/// <summary>
|
||||
/// Returns the <see cref="System.Uri"/> handle for this resource.
|
||||
/// </summary>
|
||||
@@ -259,7 +258,7 @@ namespace Spring.Core.IO
|
||||
return new Uri(_fullResourceName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -44,8 +44,6 @@ namespace Spring.Expressions
|
||||
[Serializable]
|
||||
public class PropertyOrFieldNode : BaseNode
|
||||
{
|
||||
//private static readonly Common.Logging.ILog Log = Common.Logging.LogManager.GetLogger(typeof(PropertyOrFieldNode));
|
||||
|
||||
private const BindingFlags BINDING_FLAGS =
|
||||
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static |
|
||||
BindingFlags.IgnoreCase;
|
||||
|
||||
102
src/Spring/Spring.Data/Data/Common/DbProviderConfigurer.cs
Normal file
102
src/Spring/Spring.Data/Data/Common/DbProviderConfigurer.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Common.Logging;
|
||||
using Spring.Core;
|
||||
using Spring.Core.IO;
|
||||
using Spring.Objects.Factory.Config;
|
||||
|
||||
namespace Spring.Data.Common
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
public class DbProviderConfigurer : IObjectFactoryPostProcessor, IOrdered
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(DbProviderConfigurer));
|
||||
|
||||
private int order = Int32.MinValue;
|
||||
|
||||
private IResource providerResource;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
|
||||
/// </summary>
|
||||
public DbProviderConfigurer()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the provider resource which contains additional IDbProvider definitions.
|
||||
/// </summary>
|
||||
/// <value>The provider resource.</value>
|
||||
public IResource ProviderResource
|
||||
{
|
||||
get { return providerResource; }
|
||||
set { providerResource = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IObjectFactoryPostProcessor
|
||||
|
||||
/// <summary>
|
||||
/// Modify the application context's internal object factory after its
|
||||
/// standard initialization.
|
||||
/// </summary>
|
||||
/// <param name="factory">The object factory used by the application context.</param>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// All object definitions will have been loaded, but no objects will have
|
||||
/// been instantiated yet. This allows for overriding or adding properties
|
||||
/// even to eager-initializing objects.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
/// <exception cref="Spring.Objects.ObjectsException">
|
||||
/// In case of errors.
|
||||
/// </exception>
|
||||
public void PostProcessObjectFactory(IConfigurableListableObjectFactory factory)
|
||||
{
|
||||
DbProviderFactory.DBPROVIDER_ADDITIONAL_RESOURCE_NAME = providerResource.Uri.AbsoluteUri;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IOrdered
|
||||
|
||||
public int Order
|
||||
{
|
||||
get { return order; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
@@ -124,8 +124,6 @@ namespace Spring.Data.Common
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
//TODO get from well know location in app.config....
|
||||
ConfigurableResourceLoader loader = new ConfigurableResourceLoader(DBPROVIDER_ADDITIONAL_RESOURCE_NAME);
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Spring.Core.IO;
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Util;
|
||||
|
||||
|
||||
@@ -44,15 +44,18 @@ namespace Spring.Data.Config
|
||||
NamespaceParser(
|
||||
Namespace = "http://www.springframework.net/database",
|
||||
SchemaLocationAssemblyHint = typeof(DatabaseNamespaceParser),
|
||||
SchemaLocation = "/Spring.Data.Config/spring-database-1.1.xsd")
|
||||
]
|
||||
public class DatabaseNamespaceParser : AbstractSingleObjectDefinitionParser
|
||||
SchemaLocation = "/Spring.Data.Config/spring-database-1.3.xsd")
|
||||
]
|
||||
public class DatabaseNamespaceParser : ObjectsNamespaceParser
|
||||
{
|
||||
|
||||
private const string DatabaseTypePrefix = "database: ";
|
||||
|
||||
static DatabaseNamespaceParser()
|
||||
{
|
||||
{
|
||||
TypeRegistry.RegisterType(
|
||||
DatabaseTypePrefix + DbProviderConfigurerConstants.DbProviderConfigurerElement,
|
||||
typeof(DbProviderConfigurer));
|
||||
TypeRegistry.RegisterType(
|
||||
DatabaseTypePrefix + DbProviderFactoryObjectConstants.DbProviderFactoryObjectElement,
|
||||
typeof (DbProviderFactoryObject));
|
||||
@@ -63,55 +66,105 @@ namespace Spring.Data.Config
|
||||
/// </summary>
|
||||
public DatabaseNamespaceParser()
|
||||
{
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Parse the specified element and register any resulting
|
||||
// /// IObjectDefinitions with the IObjectDefinitionRegistry that is
|
||||
// /// embedded in the supplied ParserContext.
|
||||
// /// </summary>
|
||||
// /// <param name="element">The element to be parsed into one or more IObjectDefinitions</param>
|
||||
// /// <param name="parserContext">The object encapsulating the current state of the parsing
|
||||
// /// process.</param>
|
||||
// /// <returns>
|
||||
// /// The primary IObjectDefinition (can be null as explained above)
|
||||
// /// </returns>
|
||||
// /// <remarks>
|
||||
// /// Implementations should return the primary IObjectDefinition
|
||||
// /// that results from the parse phase if they wish to used nested
|
||||
// /// inside (for example) a <code><property></code> tag.
|
||||
// /// <para>Implementations may return null if they will not
|
||||
// /// be used in a nested scenario.
|
||||
// /// </para>
|
||||
// /// </remarks>
|
||||
// [Obsolete("not used anymore - ObjectsNamespaceParser will be dropped with 2.x, use ObjectDefinitionParserHelper instead", false)]
|
||||
// public override IObjectDefinition ParseElement(XmlElement element, ParserContext parserContext)
|
||||
// {
|
||||
// string id = GetAttributeValue(element, ObjectDefinitionConstants.IdAttribute);
|
||||
// IConfigurableObjectDefinition databaseConfiguration = ParseDatabaseDefinition(element, id, parserContext);
|
||||
// if (!StringUtils.HasText(id))
|
||||
// {
|
||||
// id = ObjectDefinitionReaderUtils.GenerateObjectName(databaseConfiguration, parserContext.Registry);
|
||||
// }
|
||||
// #region Instrumentation
|
||||
//
|
||||
// if (log.IsDebugEnabled)
|
||||
// {
|
||||
// log.Debug(
|
||||
// string.Format(
|
||||
// CultureInfo.InvariantCulture,
|
||||
// "Registering object definition with id '{0}'.", id));
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
// parserContext.Registry.RegisterObjectDefinition(id, databaseConfiguration);
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse the specified element and register any resulting
|
||||
/// IObjectDefinitions with the IObjectDefinitionRegistry that is
|
||||
/// embedded in the supplied ParserContext.
|
||||
/// </summary>
|
||||
/// <param name="element">The element to be parsed into one or more IObjectDefinitions</param>
|
||||
/// <param name="parserContext">The object encapsulating the current state of the parsing
|
||||
/// process.</param>
|
||||
/// <returns>
|
||||
/// The primary IObjectDefinition (can be null as explained above)
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Implementations should return the primary IObjectDefinition
|
||||
/// that results from the parse phase if they wish to used nested
|
||||
/// inside (for example) a <code><property></code> tag.
|
||||
/// <para>Implementations may return null if they will not
|
||||
/// be used in a nested scenario.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public override IObjectDefinition ParseElement(XmlElement element, ParserContext parserContext)
|
||||
{
|
||||
string name = element.GetAttribute(ObjectDefinitionConstants.IdAttribute);
|
||||
IConfigurableObjectDefinition remotingDefinition = ParseDbProviderDefinition(element, name, parserContext);
|
||||
if (!StringUtils.HasText(name))
|
||||
{
|
||||
name = ObjectDefinitionReaderUtils.GenerateObjectName(remotingDefinition, parserContext.Registry);
|
||||
}
|
||||
parserContext.Registry.RegisterObjectDefinition(name, remotingDefinition);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parses database provider definitions.
|
||||
/// </summary>
|
||||
/// <param name="element">Validator XML element.</param>
|
||||
/// <param name="name">The name of the object definition.</param>
|
||||
/// <param name="parserContext">The parser context.</param>
|
||||
/// <returns>A database provider object definition.</returns>
|
||||
private IConfigurableObjectDefinition ParseDbProviderDefinition(
|
||||
XmlElement element, string name, ParserContext parserContext)
|
||||
{
|
||||
switch (element.LocalName)
|
||||
{
|
||||
case DbProviderConfigurerConstants.DbProviderConfigurerElement:
|
||||
return ParseDbProviderConfigurer(element, name, parserContext);
|
||||
case DbProviderFactoryObjectConstants.DbProviderFactoryObjectElement:
|
||||
return ParseDbProviderFactoryObject(element, name, parserContext);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private IConfigurableObjectDefinition ParseDbProviderConfigurer(XmlElement element, string name, ParserContext parserContext)
|
||||
{
|
||||
string typeName = GetTypeName(element);
|
||||
string resource = GetAttributeValue(element, DbProviderConfigurerConstants.ResourceAttribute);
|
||||
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
if (StringUtils.HasText(resource))
|
||||
{
|
||||
propertyValues.Add("ProviderResource", resource);
|
||||
}
|
||||
IConfigurableObjectDefinition cod = parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(
|
||||
typeName, null, parserContext.ReaderContext.Reader.Domain);
|
||||
cod.PropertyValues = propertyValues;
|
||||
return cod;
|
||||
}
|
||||
|
||||
private IConfigurableObjectDefinition ParseDbProviderFactoryObject(XmlElement element, string name, ParserContext parserContext)
|
||||
{
|
||||
string typeName = GetTypeName(element);
|
||||
|
||||
string providerNameAttribute = GetAttributeValue(element, DbProviderFactoryObjectConstants.ProviderNameAttribute);
|
||||
string connectionString = GetAttributeValue(element, DbProviderFactoryObjectConstants.ConnectionStringAttribute);
|
||||
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
if (StringUtils.HasText(providerNameAttribute))
|
||||
{
|
||||
propertyValues.Add("Provider", providerNameAttribute);
|
||||
}
|
||||
if (StringUtils.HasText(connectionString))
|
||||
{
|
||||
propertyValues.Add("ConnectionString", connectionString);
|
||||
}
|
||||
IConfigurableObjectDefinition cod = parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(
|
||||
typeName, null, parserContext.ReaderContext.Reader.Domain);
|
||||
cod.PropertyValues = propertyValues;
|
||||
return cod;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
|
||||
{
|
||||
// base.DoParse(element, parserContext, builder);
|
||||
switch (element.LocalName)
|
||||
{
|
||||
case DbProviderFactoryObjectConstants.DbProviderFactoryObjectElement:
|
||||
@@ -121,42 +174,41 @@ namespace Spring.Data.Config
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private IConfigurableObjectDefinition ParseDatabaseDefinition(XmlElement element, string name, ParserContext parserContext)
|
||||
// {
|
||||
// switch (element.LocalName)
|
||||
// {
|
||||
// case DbProviderFactoryObjectConstants.DbProviderFactoryObjectElement:
|
||||
// return ParseDatabaseConfigurer(element, name, parserContext);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
private void ParseDatabaseConfigurer(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
|
||||
{
|
||||
// string typeName = GetTypeName(element);
|
||||
{
|
||||
string providerNameAttribute = GetAttributeValue(element, DbProviderFactoryObjectConstants.ProviderNameAttribute);
|
||||
string connectionString = GetAttributeValue(element, DbProviderFactoryObjectConstants.ConnectionStringAttribute);
|
||||
string connectionString = GetAttributeValue(element, DbProviderFactoryObjectConstants.ConnectionStringAttribute);
|
||||
|
||||
// MutablePropertyValues properties = new MutablePropertyValues();
|
||||
if (StringUtils.HasText(providerNameAttribute))
|
||||
{
|
||||
builder.AddPropertyValue("Provider", providerNameAttribute);
|
||||
// properties.Add("Provider", providerNameAttribute);
|
||||
}
|
||||
if (StringUtils.HasText(connectionString))
|
||||
{
|
||||
builder.AddPropertyValue("ConnectionString", connectionString);
|
||||
// properties.Add("ConnectionString", connectionString);
|
||||
}
|
||||
|
||||
// IConfigurableObjectDefinition cod = parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(
|
||||
// typeName, null, parserContext.ReaderContext.Reader.Domain);
|
||||
// cod.PropertyValues = properties;
|
||||
|
||||
// return builder.ObjectDefinition;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the object type for the specified element.
|
||||
/// </summary>
|
||||
/// <param name="element">The element.</param>
|
||||
/// <returns>The name of the object type.</returns>
|
||||
private string GetTypeName(XmlElement element)
|
||||
{
|
||||
string typeName = GetAttributeValue(element, ObjectDefinitionConstants.TypeAttribute);
|
||||
if (StringUtils.IsNullOrEmpty(typeName))
|
||||
{
|
||||
return DatabaseTypePrefix + element.LocalName;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
/*
|
||||
protected override string GetObjectTypeName(XmlElement element)
|
||||
{
|
||||
string typeName = GetAttributeValue(element, ObjectDefinitionConstants.TypeAttribute);
|
||||
@@ -165,29 +217,20 @@ namespace Spring.Data.Config
|
||||
return DatabaseTypePrefix + element.LocalName;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Gets the name of the object type for the specified element. This has already been aliased
|
||||
// /// in the static constructor.
|
||||
// /// </summary>
|
||||
// /// <param name="element">The element.</param>
|
||||
// /// <returns>The name of the object type.</returns>
|
||||
// private string GetTypeName(XmlElement element)
|
||||
// {
|
||||
// string typeName = GetAttributeValue(element, ObjectDefinitionConstants.TypeAttribute);
|
||||
// if (StringUtils.IsNullOrEmpty(typeName))
|
||||
// {
|
||||
// return DatabaseTypePrefix + element.LocalName;
|
||||
// }
|
||||
// return typeName;
|
||||
// }
|
||||
}*/
|
||||
|
||||
private class DbProviderFactoryObjectConstants
|
||||
{
|
||||
public const string DbProviderFactoryObjectElement = "provider";
|
||||
public const string ProviderNameAttribute = "provider";
|
||||
public const string ConnectionStringAttribute = "connectionString";
|
||||
public const string ConnectionStringAttribute = "connectionString";
|
||||
|
||||
}
|
||||
|
||||
private class DbProviderConfigurerConstants
|
||||
{
|
||||
public const string DbProviderConfigurerElement = "additionalProviders";
|
||||
public const string ResourceAttribute = "resource";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
304
src/Spring/Spring.Data/Data/Config/spring-database-1.3.xsd
Normal file
304
src/Spring/Spring.Data/Data/Config/spring-database-1.3.xsd
Normal file
@@ -0,0 +1,304 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns="http://www.springframework.net/database"
|
||||
xmlns:objects="http://www.springframework.net"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:vs="http://schemas.microsoft.com/Visual-Studio-Intellisense"
|
||||
targetNamespace="http://www.springframework.net/database"
|
||||
elementFormDefault="qualified" attributeFormDefault="unqualified"
|
||||
vs:friendlyname="Spring.NET Database Framework Configuration" vs:ishtmlschema="false" vs:iscasesensitive="true" vs:requireattributequotes="true" vs:defaultnamespacequalifier="" vs:defaultnsprefix="">
|
||||
|
||||
<xs:import namespace="http://www.springframework.net"/>
|
||||
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Spring.NET Database Framework Config Schema Definition
|
||||
|
||||
Author: Mark Pollack
|
||||
|
||||
This file defines a configuration schema for the database framework
|
||||
object definitions. Using elements from this schema instead of the
|
||||
standard object definitions can greatly simplify remoting configuration.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:element name="provider">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Defines a DbProvider instance</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:string" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The id of the DbProvider instance to be referenced.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="provider" type="providerType" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The name of the database provider.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="connectionString" type="xs:string" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The database connection string.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name="additionalProviders">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Defines location of configuration for that defines additional DbProviders</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:attribute name="resource" type="xs:string" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The Spring IResource location that contains additional IDbProvider definitions.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
||||
|
||||
|
||||
<xs:simpleType name="providerType">
|
||||
<xs:union>
|
||||
<xs:simpleType id="customProvider">
|
||||
<xs:restriction base="objects:nonNullString"/>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType id="buildinProvider">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="SqlServer-1.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Microsoft SQL Server, provider V1.0.5000.0 in framework .NET V1.1</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SqlServer-2.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="System.Data.SqlClient">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SqlServerCe-3.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Microsoft SQL Server Compact Edition, provider V9.0.242.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SqlServerCe-3.5.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Microsoft SQL Server Compact Edition, provider V3.5.1.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="System.Data.SqlServerCe">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Microsoft SQL Server Compact Edition, provider V3.5.1.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="OleDb-1.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>OleDb, provider V1.0.5000.0 in framework .NET V1.1</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="OleDb-2.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>OleDb, provider V2.0.0.0 in framework .NET V2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="System.Data.OleDb">
|
||||
<xs:annotation>
|
||||
<xs:documentation>OleDb, provider V2.0.0.0 in framework .NET V2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="OracleClient-2.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Oracle, Microsoft provider V2.0.0.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="System.Data.OracleClient">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Oracle, Oracle provider V2.102.2.20</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="OracleODP-2.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Oracle, Oracle provider V2.102.2.20</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Oracle.DataAccess.Client">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Oracle, Oracle provider V2.102.2.20</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="OracleODP-11-2.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Oracle, Oracle provider V2.111.7.20</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 1.0.7.3007</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql-1.0.9">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 1.0.9.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql-5.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 5.0.7.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql-5.0.8.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 5.0.8.1</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql-5.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 5.1.2.2</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql-5.1.4">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 5.1.4.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql-5.2.3">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 5.2.3.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql-6.1.3">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 6.1.3.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql-6.2.2">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 6.2.2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="MySql.Data.MySqlClient">
|
||||
<xs:annotation>
|
||||
<xs:documentation>MySQL provider 6.2.2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Npgsql-1.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Npgsql provider 1.0.0.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Npgsql-2.0-beta1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Npgsql provider beta-1 1.98.1.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Npgsql-2.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Npgsql provider 2.0.0.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="DB2-9.1.0-1.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>IBM DB2 Data Provider 9.1.0 for .NET Framework 1.1</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="DB2-9.1.0.2">
|
||||
<xs:annotation>
|
||||
<xs:documentation>IBM DB2 Data Provider 9.1.0 for .NET Framework 2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="IBM.Data.DB2.9.1.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>IBM DB2 Data Provider 9.1.0 for .NET Framework 2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="iDB2-10.0.0.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>IBM iSeries DB2 Data Provider 10.0.0.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SQLite-1.0.43">
|
||||
<xs:annotation>
|
||||
<xs:documentation>SQLite 1.0.43 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SQLite-1.0.44">
|
||||
<xs:annotation>
|
||||
<xs:documentation>SQLite 1.0.44 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SQLite-1.0.47">
|
||||
<xs:annotation>
|
||||
<xs:documentation>SQLite 1.0.47 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SQLite-1.0.56">
|
||||
<xs:annotation>
|
||||
<xs:documentation>SQLite 1.0.56 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SQLite-1.0.65">
|
||||
<xs:annotation>
|
||||
<xs:documentation>SQLite 1.0.65 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="System.Data.SQLite">
|
||||
<xs:annotation>
|
||||
<xs:documentation>SQLite 1.0.65 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Firebird-2.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Firebird Server, provider V2.1.0.0 in framework .NET V2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="FirebirdSql.Data.FirebirdClient">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Firebird Server, provider V2.1.0.0 in framework .NET V2.0</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SybaseAse-12">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Sybase ASE 12.5, 1.1.411 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SybaseAse-15">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Sybase ASE 15, 1.15.152 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="SybaseAse-AdoNet2">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Sybase ADO.NET ASE 12.5 and ASE 15, 1.15.192.0 provider</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Odbc-1.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Microsoft ODBC, provider V1.0.5000.0 in framework .NET V1.1</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Odbc-2.0">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Microsoft ODBC, provider V2.0.0.0 in framework .NET V2</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="Cache-2.0.0.1">
|
||||
<xs:annotation>
|
||||
<xs:documentation>InterSystems CacheConnection Version 2.0.0.1 in framework .NET V2</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
<xs:enumeration value="InterSystems.Data.CacheClient">
|
||||
<xs:annotation>
|
||||
<xs:documentation>InterSystems CacheConnection Version 2.0.0.1 in framework .NET V2</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:enumeration>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:union>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
|
||||
<XSDDesignerLayout Style="LeftRight" />
|
||||
@@ -438,6 +438,11 @@
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Common\DbProviderConfigurer.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Common\DbProviderFactory.cs"
|
||||
SubType = "Code"
|
||||
@@ -503,9 +508,14 @@
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Config\spring-database-1.1.xsd"
|
||||
RelPath = "Data\Config\spring-database-1.3.xsd"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Config\spring-database-1.3.xsx"
|
||||
DependentUpon = "spring-database-1.3.xsd"
|
||||
BuildAction = "None"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Core\AdoAccessor.cs"
|
||||
SubType = "Code"
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
<Compile Include="Data\Common\DbParameter.cs" />
|
||||
<Compile Include="Data\Common\DbParameters.cs" />
|
||||
<Compile Include="Data\Common\DbProvider.cs" />
|
||||
<Compile Include="Data\Common\DbProviderConfigurer.cs" />
|
||||
<Compile Include="Data\Common\DbProviderFactory.cs" />
|
||||
<Compile Include="Data\Common\DbProviderFactoryObject.cs" />
|
||||
<Compile Include="Data\Common\DbParametersBuilder.cs" />
|
||||
@@ -317,6 +318,14 @@
|
||||
<Name>Spring.Core.2005</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\Config\spring-database-1.3.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<None Include="Data\Config\spring-database-1.3.xsx">
|
||||
<DependentUpon>spring-database-1.3.xsd</DependentUpon>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
<Compile Include="Data\Common\DbParameter.cs" />
|
||||
<Compile Include="Data\Common\DbParameters.cs" />
|
||||
<Compile Include="Data\Common\DbProvider.cs" />
|
||||
<Compile Include="Data\Common\DbProviderConfigurer.cs" />
|
||||
<Compile Include="Data\Common\DbProviderFactory.cs" />
|
||||
<Compile Include="Data\Common\DbProviderFactoryObject.cs" />
|
||||
<Compile Include="Data\Common\DbParametersBuilder.cs" />
|
||||
@@ -315,6 +316,9 @@
|
||||
<Name>Spring.Core.2008</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\Config\spring-database-1.3.xsd" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
</resources>
|
||||
<resources basedir="." prefix="Spring.Data.Config" failonempty="true">
|
||||
<include name="Data/Config/spring-database-1.1.xsd" />
|
||||
<include name="Data/Config/spring-database-1.3.xsd" />
|
||||
</resources>
|
||||
<resources basedir="." prefix="Spring.Transaction.Config" failonempty="true">
|
||||
<include name="Transaction/Config/spring-tx-1.1.xsd" />
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'>
|
||||
<object id="MySqlPersonal" type="Spring.Data.Common.DbProvider, Spring.Data" lazy-init="true">
|
||||
<constructor-arg name="dbMetaData">
|
||||
<object type="Spring.Data.Common.DbMetadata">
|
||||
<constructor-arg name="productName" value="MySQL, MySQL provider 1.0.7.30072" />
|
||||
<constructor-arg name="assemblyName" value="MySql.Data, Version=1.0.7.30072, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
|
||||
<constructor-arg name="connectionType" value="MySql.Data.MySqlClient.MySqlConnection"/>
|
||||
<constructor-arg name="commandType" value="MySql.Data.MySqlClient.MySqlCommand"/>
|
||||
<constructor-arg name="parameterType" value="MySql.Data.MySqlClient.MySqlParameter"/>
|
||||
<constructor-arg name="dataAdapterType" value="MySql.Data.MySqlClient.MySqlDataAdapter"/>
|
||||
<constructor-arg name="commandBuilderType" value="MySql.Data.MySqlClient.MySqlCommandBuilder"/>
|
||||
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
|
||||
<constructor-arg name="parameterDbType" value="MySql.Data.MySqlClient.MySqlDbType"/>
|
||||
<constructor-arg name="parameterDbTypeProperty" value="MySqlDbType"/>
|
||||
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
|
||||
<constructor-arg name="parameterNamePrefix" value="?"/>
|
||||
<constructor-arg name="exceptionType" value="MySql.Data.MySqlClient.MySqlException"/>
|
||||
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
|
||||
<constructor-arg name="bindByName" value="true"/>
|
||||
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
|
||||
obtaining error codes-->
|
||||
<constructor-arg name="errorCodeExceptionExpression" value="Number.ToString()"/>
|
||||
|
||||
<property name="ErrorCodes.badSqlGrammarCodes">
|
||||
<value>1054,1064,1146</value>
|
||||
</property>
|
||||
<property name="ErrorCodes.DataAccessResourceFailureCodes">
|
||||
<value>1</value>
|
||||
</property>
|
||||
<property name="ErrorCodes.DataIntegrityViolationCodes">
|
||||
<value>1062</value>
|
||||
</property>
|
||||
<property name="ErrorCodes.CannotAcquireLockCodes">
|
||||
<value>1205</value>
|
||||
</property>
|
||||
<property name="ErrorCodes.DeadlockLoserCodes">
|
||||
<value>1213</value>
|
||||
</property>
|
||||
</object>
|
||||
</constructor-arg>
|
||||
</object>
|
||||
</objects>
|
||||
@@ -20,11 +20,12 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Threading;
|
||||
using Spring.Util;
|
||||
|
||||
namespace Spring.Data.Common
|
||||
{
|
||||
@@ -56,13 +57,21 @@ namespace Spring.Data.Common
|
||||
|
||||
#endregion
|
||||
|
||||
private static string altConfig = "assembly://Spring.Data.Tests/Spring.Data.Common/AdditionalProviders.xml";
|
||||
|
||||
private IApplicationContext ctx;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
public void SetUp()
|
||||
{
|
||||
DbProviderFactory.DBPROVIDER_ADDITIONAL_RESOURCE_NAME = altConfig;
|
||||
//Other tests in this assembly will have already initialized the internal context that is part of DbProviderFactory
|
||||
//Reset it back to null so that tests for specifiying additional database providers will be able 're-initialize'
|
||||
//the internal Context of DbProviderFactory.
|
||||
//Spring.Objects.Factory.Xml.NamespaceParserRegistry.RegisterParser(typeof(Spring.Data.Config.DatabaseNamespaceParser));
|
||||
if (DbProviderFactory.ApplicationContext != null)
|
||||
{
|
||||
FieldInfo fieldInfo = typeof (DbProviderFactory).GetField("ctx", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
fieldInfo.SetValue(null, null);
|
||||
}
|
||||
ctx = new XmlApplicationContext("assembly://Spring.Data.Tests/Spring.Data.Common/DbProviderFactoryTests.xml");
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
@@ -83,16 +92,13 @@ namespace Spring.Data.Common
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Can't guarantee test order")]
|
||||
public void AdditionalResourceName()
|
||||
{
|
||||
|
||||
{
|
||||
IDbProvider provider = DbProviderFactory.GetDbProvider("Test-SqlServer-2.0");
|
||||
Assert.IsNotNull(provider);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Can't guarantee test order")]
|
||||
public void BadErrorExpression()
|
||||
{
|
||||
|
||||
@@ -106,8 +112,8 @@ namespace Spring.Data.Common
|
||||
public void DefaultInstanceWithSqlServer2005()
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
|
||||
IApplicationContext ctx = DbProviderFactory.ApplicationContext;
|
||||
Assert.IsNotNull(ctx);
|
||||
//IApplicationContext ctx = DbProviderFactory.ApplicationContext;
|
||||
//Assert.IsNotNull(ctx);
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("tr-TR", false);
|
||||
IDbProvider provider = DbProviderFactory.GetDbProvider("SqlServer-2.0");
|
||||
AssertIsSqlServer2005(provider);
|
||||
@@ -150,8 +156,8 @@ namespace Spring.Data.Common
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
[Ignore("until find out if can add oracle.dll to cvs repository")]
|
||||
//[Test]
|
||||
//Comment in for specific testing with oracle as can't put oracle client in public code repository
|
||||
public void DefaultInstanceWithOracleClient20()
|
||||
{
|
||||
IDbProvider provider = DbProviderFactory.GetDbProvider("OracleODP-2.0");
|
||||
@@ -181,11 +187,11 @@ namespace Spring.Data.Common
|
||||
[Test]
|
||||
public void TestDb2()
|
||||
{
|
||||
//Initialize internal application context. factory
|
||||
DbProviderFactory.GetDbProvider("SqlServer-2.0");
|
||||
IApplicationContext ctx = DbProviderFactory.ApplicationContext;
|
||||
string[] dbProviderNames = ctx.GetObjectNamesForType(typeof(IDbProvider));
|
||||
Console.WriteLine(
|
||||
String.Format("{0} DbProviders Available. [{1}]", dbProviderNames.Length,
|
||||
StringUtils.ArrayToCommaDelimitedString(dbProviderNames)));
|
||||
Assert.IsTrue(dbProviderNames.Length > 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
|
||||
<db:additionalProviders resource="assembly://Spring.Data.Tests/Spring.Data.Common/AdditionalProviders.xml"/>
|
||||
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="System.Data.SqlClient"
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/>
|
||||
|
||||
|
||||
</objects>
|
||||
|
||||
@@ -226,9 +226,9 @@ namespace Spring.Data.Common
|
||||
|
||||
Exception e = new Exception("foo");
|
||||
Expect.Call(dbProvider.ExtractError(e)).Return("badsql").Repeat.Once();
|
||||
|
||||
#if !NET_1_1
|
||||
DbException dbException = (DbException) mocks.CreateMock(typeof (DbException));
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
MultiDelegatingDbProvider multiDbProvider = new MultiDelegatingDbProvider();
|
||||
@@ -255,7 +255,9 @@ namespace Spring.Data.Common
|
||||
Assert.IsNotNull(multiDbProvider.DbMetadata);
|
||||
Assert.AreEqual("badsql", multiDbProvider.ExtractError(e));
|
||||
|
||||
#if !NET_1_1
|
||||
Assert.IsTrue(multiDbProvider.IsDataAccessException(dbException));
|
||||
#endif
|
||||
Assert.IsFalse(multiDbProvider.IsDataAccessException(e));
|
||||
mocks.VerifyAll();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
DelaySign = "false"
|
||||
OutputType = "Library"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
PostBuildEvent = 'echo copying "$(ProjectDir)$(TargetFileName).config" to "..\..\..\..\build\VS.Net.2003\Spring.Core.Tests\$(ConfigurationName)\$(TargetFileName).config"
copy "$(ProjectDir)$(TargetFileName).config" ..\..\..\..\build\VS.Net.2003\Spring.Core.Tests\$(ConfigurationName)\$(TargetFileName).config'
|
||||
RootNamespace = "Spring"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
@@ -154,7 +154,7 @@
|
||||
/>
|
||||
<File
|
||||
RelPath = "Spring.Data.Tests.dll.config"
|
||||
BuildAction = "None"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Dao\IncorrectResultSizeDataAccessExceptionTests.cs"
|
||||
@@ -211,14 +211,33 @@
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Common\AdditonalProviders.xml"
|
||||
RelPath = "Data\Common\AdditionalProviders.xml"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Common\DbParametersTests.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Common\DbProviderFactoryTests.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Common\DbProviderFactoryTests.xml"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Common\MultiDelegatingDbProviderTests.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Common\UserCredentialsDbProviderTests.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Data\Core\ServiceDomainTransactionManagerTests.cs"
|
||||
SubType = "Code"
|
||||
|
||||
@@ -165,6 +165,7 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\AutoDeclarativeTxTests.xml" />
|
||||
<EmbeddedResource Include="Data\Common\AdditionalProviders.xml" />
|
||||
<EmbeddedResource Include="Data\Common\DbProviderFactoryTests.xml" />
|
||||
<Content Include="Spring.Data.Tests.dll.config" />
|
||||
<EmbeddedResource Include="Transaction\Interceptor\MatchAlwaysTransactionAttributeSourceTests.xml" />
|
||||
<EmbeddedResource Include="Transaction\Config\TxNamespaceParserTests.xml" />
|
||||
@@ -175,6 +176,7 @@
|
||||
<Compile Include="Dao\Attributes\PersistenceExceptionTranslationPostProcessorTests.cs" />
|
||||
<Compile Include="Dao\Support\DataAccessUtilsTests.cs" />
|
||||
<Compile Include="Data\Common\DbParametersTests.cs" />
|
||||
<Compile Include="Data\Common\MultiDelegatingDbProviderTests.cs" />
|
||||
<Compile Include="Data\Common\UserCredentialsDbProviderTests.cs" />
|
||||
<Compile Include="Data\Core\ServiceDomainTransactionManagerTests.cs" />
|
||||
<Compile Include="Data\Core\TxScopeTransactionManagerIntegrationTests.cs" />
|
||||
|
||||
@@ -165,6 +165,7 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\AutoDeclarativeTxTests.xml" />
|
||||
<EmbeddedResource Include="Data\Common\AdditionalProviders.xml" />
|
||||
<EmbeddedResource Include="Data\Common\DbProviderFactoryTests.xml" />
|
||||
<Content Include="Spring.Data.Tests.dll.config" />
|
||||
<Content Include="Transaction\Config\TxNamespaceParserTests_TxAttributeDriven.xml" />
|
||||
<EmbeddedResource Include="Transaction\Interceptor\MatchAlwaysTransactionAttributeSourceTests.xml" />
|
||||
|
||||
@@ -24,7 +24,9 @@ limitations under the License.
|
||||
|
||||
<sectionGroup name='spring'>
|
||||
<section name='context' type='Spring.Context.Support.ContextHandler, Spring.Core'/>
|
||||
<section name='objects' type='Spring.Context.Support.DefaultSectionHandler, Spring.Core' />
|
||||
<section name='objects' type='Spring.Context.Support.DefaultSectionHandler, Spring.Core' />
|
||||
<section name='parsers' type='Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core' />
|
||||
|
||||
</sectionGroup>
|
||||
|
||||
<!--
|
||||
@@ -51,6 +53,11 @@ limitations under the License.
|
||||
|
||||
</objects>
|
||||
|
||||
|
||||
<parsers>
|
||||
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
|
||||
</parsers>
|
||||
|
||||
</spring>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user