Merge branch 'master' of git://github.com/SpringSource/spring-net.git

This commit is contained in:
Marijn van der Zee
2011-12-02 13:43:18 +01:00
30 changed files with 468 additions and 345 deletions

View File

@@ -109,7 +109,7 @@ Commandline Examples:
<property name="project.name" value="Spring.NET"/>
<property name="project.name.full" value="Spring.NET Framework"/>
<property name="spring.basedir" value="${project::get-base-directory()}"/>
<property name="spring.nonredistdir" value="${spring.basedir}\..\nonredist"/>
<property name="spring.nonredistdir" value="${spring.basedir}\..\..\nonredist"/>
<property name="tool.dir" value="${project::get-base-directory()}\build-support\tools"/>
<!-- build SDK docs with NDoc -->
@@ -609,7 +609,7 @@ Commandline Examples:
<call target="copykeys" if="${project.build.sign}"/>
<call target="copylibs" />
<call target="common.generate-assemblyinfo"/>
<property name="build-ems" value="true" overwrite="true" />
<property name="build-ems" value="false" overwrite="true" />
<property name="build-nms" value="true" overwrite="true" />
<property name="build-quartz" value="true" overwrite="true" />
<property name="build-msmq" value="true" overwrite="true" />

View File

@@ -52,7 +52,7 @@ Rebuilding Solutions using Nant and "solutions.build":
</in>
<do>
<delete dir="${dirname}" failonerror="false"/>
<sleep seconds="1"/>
<sleep seconds="2"/>
<delete dir="${dirname}" />
</do>
</foreach>

View File

@@ -319,7 +319,7 @@ ${tool.dir} : dir for tools
<arg value="-output:${test.bin.dir}/${test.assemblyname}.dll-TestCoverage.xml" />
</exec>
<exec program="${tool.dir}\ReporterGenerator\bin\ReportGenerator.exe" workingdir="${test.bin.dir}" verbose="true">
<exec program="${tool.dir}\ReportGenerator\bin\ReportGenerator.exe" workingdir="${test.bin.dir}" verbose="true">
<arg value="${test.assemblyname}.dll-TestCoverage.xml" />
<arg path="${test.bin.dir}\CoverageReport\${test.assemblyname}" />
</exec>

View File

@@ -2047,54 +2047,25 @@ public static void ApplyConnectionAndTx(object typedDataSetAdapter, IDbProvider
<literal>AdoQuery</literal> class is rarely used directly since the
<literal>MappingAdoQuery</literal> subclass provides a much more
convenient implementation for mapping rows to .NET classes. Another
implementations that extends <literal>AdoQuery</literal> is
implementation that extends <literal>AdoQuery</literal> is
<literal>MappingadoQueryWithParameters</literal> (See SDK docs for
details).</para>
<para>The <literal>AdoNonQuery</literal> class encapsulates an
IDbCommand 's ExecuteNonQuery method functionality. Like the
<literal>AdoQuery</literal> object, an <literal>AdoNonQuery</literal>
object is reusable, and like all <literal>AdoOperation</literal>
classes, an <literal>AdoNonQuery</literal> can have parameters and is
defined in SQL. This class provides two execute methods</para>
<itemizedlist>
<listitem>
<para><literal>IDictionary ExecuteNonQuery(params object[]
inParameterValues)</literal></para>
</listitem>
<listitem>
<para><literal>IDictionary ExecuteNonQueryByNamedParam(IDictionary
inParams)</literal></para>
</listitem>
</itemizedlist>
<para>This class is concrete. Although it can be subclassed (for example
to add a custom update method) it can easily be parameterized by setting
SQL and declaring parameters.</para>
<!--
TODO: add example of subclassing AdoQuery here
<para>An example of an AdoQuery subclass to encapsulate an insert
statement for a 'TestObject' (consisting only name and age columns) is
shown below</para>
<programlisting language="csharp">public class CreateTestObjectNonQuery : AdoNonQuery
<programlisting language="csharp">public class CreateTestObjectNonQuery : AdoQuery
{
private static string sql = "insert into TestObjects(Age,Name) values (@Age,@Name)";
public CreateTestObjectNonQuery(IDbProvider dbProvider) : base(dbProvider, sql)
{
DeclaredParameters.Add("Age", DbType.Int32);
DeclaredParameters.Add("Name", SqlDbType.NVarChar, 16);
Compile();
}
public void Create(string name, int age)
{
ExecuteNonQuery(name, age);
}
//...
}</programlisting>
-->
</sect2>
<sect2 xml:id="ado-mappingadoquery">

View File

@@ -10,9 +10,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.Server
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.ServerWeb.2008", "src\Spring.WcfQuickStart.ServerWeb\Spring.WcfQuickStart.ServerWeb.2008.csproj", "{EEC5B531-104B-44E6-975B-44C0C8973405}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.Contracts", "src\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj", "{53263837-0643-45FE-96A2-46D425E1A36F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.Contracts.2008", "src\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.2008.csproj", "{53263837-0643-45FE-96A2-46D425E1A36F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.Aspects", "src\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj", "{B52BBAA3-1B30-4905-827C-1D81EBA56A15}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.Aspects.2008", "src\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.2008.csproj", "{B52BBAA3-1B30-4905-827C-1D81EBA56A15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
<AssemblyName>Spring.WcfQuickStart.Aspects</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkSubset>
</TargetFrameworkSubset>
@@ -33,15 +33,18 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Aop, Version=1.2.0.20336, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Aop, Version=0.0.0.20000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll</HintPath>
</Reference>
<Reference Include="Spring.Core, Version=1.2.0.20336, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Core, Version=0.0.0.20000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>

View File

@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
<AssemblyName>Spring.WcfQuickStart.Aspects</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
@@ -31,6 +31,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -52,13 +53,13 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Aop, Version=1.2.0.20336, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Aop, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Aop.dll</HintPath>
</Reference>
<Reference Include="Spring.Core, Version=1.2.0.20336, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Core, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -68,23 +69,6 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SimplePerformanceInterceptor.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -1,11 +1,14 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>
<spring>
<context>
<!-- Make sure 'http://localhost:2637/Spring.WcfQuickStart.ServerWeb/' web application is running -->
@@ -15,7 +18,11 @@
<!-- Aspects definition -->
<resource uri="assembly://Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.Config/Aspects.xml"/>
</context>
<parsers>
<parser type="Spring.ServiceModel.Config.WcfNamespaceParser, Spring.Services" />
</parsers>
</spring>
<system.serviceModel>
<bindings>
<basicHttpBinding>
@@ -33,4 +40,5 @@
<endpoint name="serverAppCalculatorEndpoint" address="http://localhost:8000/Spring.WcfQuickStart/service" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1" contract="Spring.WcfQuickStart.ICalculator"/>
</client>
</system.serviceModel>
<startup/></configuration>
</configuration>

View File

@@ -14,7 +14,7 @@
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<PublishUrl>http://localhost/Spring.WcfQuickStart.ClientApp/</PublishUrl>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
@@ -52,19 +52,22 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Aop, Version=0.0.0.20468, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Aop, Version=0.0.0.20000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll</HintPath>
</Reference>
<Reference Include="Spring.Core, Version=1.2.0.20311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Core, Version=0.0.0.20000, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="Spring.Services, Version=1.2.0.30311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Services, Version=0.0.0.35000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Services.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\3.5\debug\Spring.Services.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
@@ -78,33 +81,14 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Config\ServerApp.xml" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Config\ServerWeb.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.2008.csproj">
<Project>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</Project>
<Name>Spring.WcfQuickStart.Aspects</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.2008.csproj">
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
<Name>Spring.WcfQuickStart.Contracts</Name>
</ProjectReference>

View File

@@ -15,7 +15,7 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<IsWebBootstrapper>true</IsWebBootstrapper>
<PublishUrl>http://localhost/Spring.WcfQuickStart.ClientApp/</PublishUrl>
<Install>true</Install>
@@ -31,6 +31,7 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -53,21 +54,21 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Aop, Version=0.0.0.20468, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Aop, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Aop.dll</HintPath>
</Reference>
<Reference Include="Spring.Core, Version=1.2.0.20311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Core, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="Spring.Services, Version=1.2.0.30311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Services, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Services.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Services.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
@@ -79,43 +80,14 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Config\ServerApp.xml" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Config\ServerWeb.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.2010.csproj">
<Project>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</Project>
<Name>Spring.WcfQuickStart.Aspects</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.2010.csproj">
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
<Name>Spring.WcfQuickStart.Contracts</Name>
</ProjectReference>

View File

@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
<AssemblyName>Spring.WcfQuickStart.Contracts</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkSubset>
</TargetFrameworkSubset>
@@ -34,6 +34,9 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.ServiceModel">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>

View File

@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
<AssemblyName>Spring.WcfQuickStart.Contracts</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
@@ -31,6 +31,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -64,23 +65,6 @@
<Compile Include="ICalculator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -14,7 +14,7 @@
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<PublishUrl>http://localhost/Spring.WcfQuickStart.ServerApp/</PublishUrl>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
@@ -50,19 +50,22 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Aop, Version=1.2.0.20311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Aop, Version=0.0.0.20000, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll</HintPath>
</Reference>
<Reference Include="Spring.Core, Version=1.2.0.20311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Core, Version=0.0.0.20000, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="Spring.Services, Version=1.2.0.30311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Services, Version=0.0.0.35000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Services.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\3.5\debug\Spring.Services.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
@@ -76,28 +79,11 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.2008.csproj">
<Project>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</Project>
<Name>Spring.WcfQuickStart.Aspects</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.2008.csproj">
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
<Name>Spring.WcfQuickStart.Contracts</Name>
</ProjectReference>

View File

@@ -15,7 +15,7 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<IsWebBootstrapper>true</IsWebBootstrapper>
<PublishUrl>http://localhost/Spring.WcfQuickStart.ServerApp/</PublishUrl>
<Install>true</Install>
@@ -31,6 +31,7 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -53,21 +54,21 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Aop, Version=1.2.0.20311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Aop, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Aop.dll</HintPath>
</Reference>
<Reference Include="Spring.Core, Version=1.2.0.20311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Core, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="Spring.Services, Version=1.2.0.30311, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<Reference Include="Spring.Services, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Services.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Services.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
@@ -79,38 +80,11 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.2010.csproj">
<Project>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</Project>
<Name>Spring.WcfQuickStart.Aspects</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.2010.csproj">
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
<Name>Spring.WcfQuickStart.Contracts</Name>
</ProjectReference>

View File

@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
<AssemblyName>Spring.WcfQuickStart.ServerWeb</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -30,26 +30,41 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Aop, Version=1.2.0.20336, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Aop, Version=0.0.0.20000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Aop.dll</HintPath>
</Reference>
<Reference Include="Spring.Core, Version=1.2.0.20313, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Core, Version=0.0.0.20000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="Spring.Services, Version=1.2.0.30313, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Services, Version=0.0.0.35000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Services.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\3.5\debug\Spring.Services.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.ServiceModel">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Web.config" />
@@ -60,11 +75,11 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.2008.csproj">
<Project>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</Project>
<Name>Spring.WcfQuickStart.Aspects</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.2008.csproj">
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
<Name>Spring.WcfQuickStart.Contracts</Name>
</ProjectReference>

View File

@@ -11,12 +11,13 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
<AssemblyName>Spring.WcfQuickStart.ServerWeb</AssemblyName>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<UseIISExpress>false</UseIISExpress>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -38,26 +39,32 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Aop, Version=1.2.0.20336, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Aop, Version=0.0.0.40000, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Aop.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Aop.dll</HintPath>
</Reference>
<Reference Include="Spring.Core, Version=1.2.0.20313, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Core, Version=0.0.0.40000, Culture=neutral, PublicKeyToken=65e474d141e25e07, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="Spring.Services, Version=1.2.0.30313, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Spring.Services, Version=0.0.0.40000, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\bin\net\3.0\debug\Spring.Services.dll</HintPath>
<HintPath>..\..\..\..\..\bin\net\4.0\debug\Spring.Services.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.ServiceModel">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="Web.config" />
@@ -68,11 +75,11 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Aspects\Spring.WcfQuickStart.Aspects.2010.csproj">
<Project>{B52BBAA3-1B30-4905-827C-1D81EBA56A15}</Project>
<Name>Spring.WcfQuickStart.Aspects</Name>
</ProjectReference>
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.csproj">
<ProjectReference Include="..\Spring.WcfQuickStart.Contracts\Spring.WcfQuickStart.Contracts.2010.csproj">
<Project>{53263837-0643-45FE-96A2-46D425E1A36F}</Project>
<Name>Spring.WcfQuickStart.Contracts</Name>
</ProjectReference>

View File

@@ -28,6 +28,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using Spring.Util;
using System.Reflection;
#endregion
@@ -116,6 +117,45 @@ namespace Spring.Core.TypeConversion
return ToTypedCollectionWithTypeConversion(typeof(List<>), componentType, elements, propertyName);
}
}
// if required type is some IDictionary<K,V>, convert all the elements
if (requiredType != null && requiredType.IsGenericType && TypeImplementsGenericInterface(requiredType, typeof(IDictionary<,>)))
{
Type[] typeParameters = requiredType.GetGenericArguments();
Type keyType = typeParameters[0];
Type valueType = typeParameters[1];
if (newValue is IDictionary)
{
IDictionary elements = (IDictionary)newValue;
Type targetCollectionType = typeof(Dictionary<,>);
Type collectionType = targetCollectionType.MakeGenericType(new Type[] { keyType, valueType });
object typedCollection = Activator.CreateInstance(collectionType);
MethodInfo addMethod = collectionType.GetMethod("Add", new Type[] { keyType, valueType });
int i = 0;
foreach (DictionaryEntry entry in elements)
{
string propertyExpr = BuildIndexedPropertyName(propertyName, i);
object key = ConvertValueIfNecessary(keyType, entry.Key, propertyExpr + ".Key");
object value = ConvertValueIfNecessary(valueType, entry.Value, propertyExpr + ".Value");
addMethod.Invoke(typedCollection, new object[] { key, value });
i++;
}
return typedCollection;
}
}
// if required type is some IEnumerable<T>, convert all the elements
if (requiredType != null && requiredType.IsGenericType && TypeImplementsGenericInterface(requiredType, typeof(IEnumerable<>)))
{
// convert individual elements to array elements
Type componentType = requiredType.GetGenericArguments()[0];
if (newValue is ICollection)
{
ICollection elements = (ICollection)newValue;
return ToTypedCollectionWithTypeConversion(typeof(List<>), componentType, elements, propertyName);
}
}
#endif
// try to convert using type converter
@@ -289,18 +329,16 @@ namespace Spring.Core.TypeConversion
throw new ArgumentException("matchingInterface Type must be an Interface Type", "matchingInterface");
}
bool match = false;
if (candidateType.IsInterface && IsMatchingGenericInterface(candidateType, matchingInterface))
{
return true;
}
bool match = false;
Type[] implementedInterfaces = candidateType.GetInterfaces();
foreach (Type interfaceType in implementedInterfaces)
{
if (false == interfaceType.IsGenericType)
{
continue;
}
Type genericType = interfaceType.GetGenericTypeDefinition();
if (genericType == matchingInterface)
if (IsMatchingGenericInterface(interfaceType, matchingInterface))
{
match = true;
break;
@@ -309,6 +347,11 @@ namespace Spring.Core.TypeConversion
return match;
}
private static bool IsMatchingGenericInterface(Type candidateInterfaceType, Type matchingGenericInterface)
{
return candidateInterfaceType.IsGenericType && candidateInterfaceType.GetGenericTypeDefinition() == matchingGenericInterface;
}
#endif
}
}

View File

@@ -1,105 +1,105 @@
using System.Collections;
using NHibernate;
using NHibernate.Cfg;
using NhCfg = NHibernate.Cfg;
using Spring.Collections;
using Spring.Threading;
using Spring.Data.Common;
using Spring.Context.Support;
using NHibernate.Engine;
using System;
namespace Spring.Data.NHibernate
{
/// <summary>
/// SimpleDelegatingSessionFactory class
/// </summary>
public class SimpleDelegatingSessionFactory : DelegatingSessionFactory
{
/// <summary>
/// Connection string config element name
/// </summary>
public const string CONNECTION_STRING = "SimpleDelegatingSessionFactory.ConnectionString";
private Configuration _configuration;
private string _defaultConnectionString;
private object _monitor = new object();
private IDictionary _targetSessionFactories = new SynchronizedHashtable();
/// <summary>
/// public Constructor
/// </summary>
/// <param name="defaultConfiguration"></param>
public SimpleDelegatingSessionFactory(Configuration defaultConfiguration)
{
if (defaultConfiguration == null)
{
throw new ArgumentException("Configuration cannot be null", "defaultConfiguration");
}
_configuration = defaultConfiguration;
if (!_configuration.Properties.ContainsKey(NhCfg.Environment.ConnectionString))
{
throw new ArgumentException("Must specify connection string");
}
_defaultConnectionString = _configuration.Properties[NhCfg.Environment.ConnectionString] as string;
if (_defaultConnectionString == null)
{
throw new ArgumentException("Connection string property must be of type string, not " +
_configuration.Properties[NhCfg.Environment.ConnectionString].GetType().FullName);
}
}
/// <summary>
/// TargetSessionFactory
/// </summary>
public override ISessionFactory TargetSessionFactory
{
get
{
string connectionString = LogicalThreadContext.GetData(CONNECTION_STRING) as string;
System.Diagnostics.Trace.WriteLine(String.Format("{0} = {1}", System.Threading.Thread.CurrentThread.GetHashCode(), connectionString));
if (connectionString == null)
{
connectionString = _defaultConnectionString;
}
lock (_monitor)
{
if (!_targetSessionFactories.Contains(connectionString))
{
System.Diagnostics.Trace.WriteLine(System.Threading.Thread.CurrentThread.GetHashCode().ToString() + " = (created) ");
_configuration.Properties[NhCfg.Environment.ConnectionString] = connectionString;
ISessionFactory sessionFactory = _configuration.BuildSessionFactory();
LocalSessionFactoryObject.DbProviderWrapper dbProviderWrapper = ((ISessionFactoryImplementor)sessionFactory).ConnectionProvider as LocalSessionFactoryObject.DbProviderWrapper;
if (dbProviderWrapper != null)
{
dbProviderWrapper.DbProvider = (IDbProvider)ContextRegistry.GetContext().GetObject("DbProvider");
}
_targetSessionFactories[connectionString] = sessionFactory;
}
else
System.Diagnostics.Trace.WriteLine(System.Threading.Thread.CurrentThread.GetHashCode().ToString() + " = (cached) ");
ISessionFactory factory = _targetSessionFactories[connectionString] as ISessionFactory;
System.Diagnostics.Trace.WriteLine(String.Format("{0} = {1}", System.Threading.Thread.CurrentThread.GetHashCode(), ((ISessionFactoryImplementor)factory).ConnectionProvider.GetConnection().ConnectionString));
return factory;
}
}
}
}
}
using System.Collections;
using NHibernate;
using NHibernate.Cfg;
using NhCfg = NHibernate.Cfg;
using Spring.Collections;
using Spring.Threading;
using Spring.Data.Common;
using Spring.Context.Support;
using NHibernate.Engine;
using System;
namespace Spring.Data.NHibernate
{
/// <summary>
/// SimpleDelegatingSessionFactory class
/// </summary>
public class SimpleDelegatingSessionFactory : DelegatingSessionFactory
{
/// <summary>
/// Connection string config element name
/// </summary>
public const string CONNECTION_STRING = "SimpleDelegatingSessionFactory.ConnectionString";
private Configuration _configuration;
private string _defaultConnectionString;
private object _monitor = new object();
private IDictionary _targetSessionFactories = new SynchronizedHashtable();
/// <summary>
/// public Constructor
/// </summary>
/// <param name="defaultConfiguration"></param>
public SimpleDelegatingSessionFactory(Configuration defaultConfiguration)
{
if (defaultConfiguration == null)
{
throw new ArgumentException("Configuration cannot be null", "defaultConfiguration");
}
_configuration = defaultConfiguration;
if (!_configuration.Properties.ContainsKey(NhCfg.Environment.ConnectionString))
{
throw new ArgumentException("Must specify connection string");
}
_defaultConnectionString = _configuration.Properties[NhCfg.Environment.ConnectionString] as string;
if (_defaultConnectionString == null)
{
throw new ArgumentException("Connection string property must be of type string, not " +
_configuration.Properties[NhCfg.Environment.ConnectionString].GetType().FullName);
}
}
/// <summary>
/// TargetSessionFactory
/// </summary>
public override ISessionFactory TargetSessionFactory
{
get
{
string connectionString = LogicalThreadContext.GetData(CONNECTION_STRING) as string;
System.Diagnostics.Trace.WriteLine(String.Format("{0} = {1}", System.Threading.Thread.CurrentThread.GetHashCode(), connectionString));
if (connectionString == null)
{
connectionString = _defaultConnectionString;
}
lock (_monitor)
{
if (!_targetSessionFactories.Contains(connectionString))
{
System.Diagnostics.Trace.WriteLine(System.Threading.Thread.CurrentThread.GetHashCode().ToString() + " = (created) ");
_configuration.Properties[NhCfg.Environment.ConnectionString] = connectionString;
ISessionFactory sessionFactory = _configuration.BuildSessionFactory();
LocalSessionFactoryObject.DbProviderWrapper dbProviderWrapper = ((ISessionFactoryImplementor)sessionFactory).ConnectionProvider as LocalSessionFactoryObject.DbProviderWrapper;
if (dbProviderWrapper != null)
{
dbProviderWrapper.DbProvider = (IDbProvider)ContextRegistry.GetContext().GetObject("DbProvider");
}
_targetSessionFactories[connectionString] = sessionFactory;
}
else
System.Diagnostics.Trace.WriteLine(System.Threading.Thread.CurrentThread.GetHashCode().ToString() + " = (cached) ");
ISessionFactory factory = _targetSessionFactories[connectionString] as ISessionFactory;
System.Diagnostics.Trace.WriteLine(String.Format("{0} = {1}", System.Threading.Thread.CurrentThread.GetHashCode(), connectionString));
return factory;
}
}
}
}
}

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<objects xmlns="http://www.springframework.net">
<object id="HasGenericIListProperty" type="Spring.Objects.TestObject, Spring.Core.Tests">
<property name="SomeGenericIListInt32">
<list>
<value>123</value>
<value>234</value>
<value>345</value>
</list>
</property>
</object>
<object id="HasGenericIDictionaryProperty" type="Spring.Objects.TestObject, Spring.Core.Tests">
<property name="SomeGenericIDictionaryStringInt32">
<dictionary>
<entry key="aaa" value="111"/>
<entry key="bbb" value="222"/>
<entry key="ccc" value="333"/>
</dictionary>
</property>
</object>
<object id="HasGenericIEnumerableProperty" type="Spring.Objects.TestObject, Spring.Core.Tests">
<property name="SomeGenericIEnumerableInt32">
<list>
<value>123</value>
</list>
</property>
</object>
</objects>

View File

@@ -0,0 +1,131 @@
#region License
/*
* Copyright <20> 2002-2011 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
#region Imports
using NUnit.Framework;
using Spring.Objects.Factory.Support;
using System.Collections;
using Spring.Core.TypeConversion;
using System.Collections.Generic;
using System.Collections.Specialized;
#endregion
namespace Spring.Objects.Factory.Xml
{
/// <summary>
/// Unit and integration tests for collection conversion support
/// </summary>
/// <author>Choy Rim</author>
[TestFixture]
[Description("SPRNET-1470 Setting property of type IList<T> using <list/> without the @element-type specified fails.")]
public class CollectionConversionGenericTests
{
private DefaultListableObjectFactory objectFactory;
[SetUp]
public void SetUp()
{
this.objectFactory = new DefaultListableObjectFactory();
IObjectDefinitionReader reader = new XmlObjectDefinitionReader(this.objectFactory);
reader.LoadObjectDefinitions(new ReadOnlyXmlTestResource("collectionConversionGeneric.xml", GetType()));
}
[Test]
public void ShouldConvertListToGenericIList()
{
TestObject to = (TestObject)this.objectFactory.GetObject("HasGenericIListProperty");
IList<int> list = to.SomeGenericIListInt32;
Assert.That(list.Count, Is.EqualTo(3));
Assert.That(list[0], Is.EqualTo(123));
Assert.That(list[1], Is.EqualTo(234));
Assert.That(list[2], Is.EqualTo(345));
}
[Test]
public void ShouldConvertDictionaryToGenericIDictionary()
{
TestObject to = (TestObject)this.objectFactory.GetObject("HasGenericIDictionaryProperty");
IDictionary<string, int> dict = to.SomeGenericIDictionaryStringInt32;
Assert.That(dict.Count, Is.EqualTo(3));
Assert.That(dict["aaa"], Is.EqualTo(111));
Assert.That(dict["bbb"], Is.EqualTo(222));
Assert.That(dict["ccc"], Is.EqualTo(333));
}
[Test]
public void ShouldConvertListToGenericIEnumerable()
{
TestObject to = (TestObject)this.objectFactory.GetObject("HasGenericIEnumerableProperty");
IEnumerable<int> enumerable = to.SomeGenericIEnumerableInt32;
int enumerableLength = 0;
int first = 0;
foreach (int i in enumerable)
{
enumerableLength += 1;
if (enumerableLength == 1)
{
first = i;
}
}
Assert.That(enumerableLength, Is.EqualTo(1));
Assert.That(first, Is.EqualTo(123));
}
[Test]
public void ConvertArrayListToGenericIList()
{
ArrayList xs = new ArrayList();
xs.Add("Mark Pollack");
object ys = TypeConversionUtils.ConvertValueIfNecessary(typeof(IList<string>), xs, "ignored");
Assert.That(ys as IList<string>, Is.Not.Null);
IList<string> zs = (IList<string>)ys;
Assert.That(zs[0], Is.EqualTo("Mark Pollack"));
}
[Test]
public void ConvertHybridDictionaryToGenericIDictionary()
{
HybridDictionary xs = new HybridDictionary();
xs.Add("first", 1);
object ys = TypeConversionUtils.ConvertValueIfNecessary(typeof(IDictionary<string, int>), xs, "ignored");
Assert.That(ys as IDictionary<string, int>, Is.Not.Null);
IDictionary<string, int> zs = (IDictionary<string, int>)ys;
Assert.That(zs["first"], Is.EqualTo(1));
}
[Test]
public void ConvertArrayListToGenericIEnumerable()
{
ArrayList xs = new ArrayList();
xs.Add("Mark Pollack");
object ys = TypeConversionUtils.ConvertValueIfNecessary(typeof(IEnumerable<string>), xs, "ignored");
Assert.That(ys as IEnumerable<string>, Is.Not.Null);
IEnumerable<string> zs = (IEnumerable<string>)ys;
IEnumerator<string> zse = zs.GetEnumerator();
Assert.That(zse.MoveNext(), Is.True);
Assert.That(zse.Current, Is.EqualTo("Mark Pollack"));
}
}
}

View File

@@ -273,6 +273,27 @@ namespace Spring.Objects
set { this.someGenericStringList = value; }
}
private IList<int> someGenericIListInt32;
public virtual IList<int> SomeGenericIListInt32
{
get { return someGenericIListInt32; }
set { someGenericIListInt32 = value; }
}
private IDictionary<string, int> someGenericIDictionaryStringInt32;
public virtual IDictionary<string, int> SomeGenericIDictionaryStringInt32
{
get { return someGenericIDictionaryStringInt32; }
set { someGenericIDictionaryStringInt32 = value; }
}
private IEnumerable<int> someGenericIEnumerableInt32;
public virtual IEnumerable<int> SomeGenericIEnumerableInt32
{
get { return someGenericIEnumerableInt32; }
set { someGenericIEnumerableInt32 = value; }
}
public virtual NameValueCollection SomeNameValueCollection
{
get { return someNameValueCollection; }

View File

@@ -343,6 +343,7 @@
<Compile Include="Objects\Factory\Xml\ArrayCtorDependencyObject.cs" />
<Compile Include="Objects\Factory\Xml\CollectionMergingTests.cs" />
<Compile Include="Objects\Factory\Xml\CollectionMergingGenericTests.cs" />
<Compile Include="Objects\Factory\Xml\CollectionConversionGenericTests.cs" />
<Compile Include="Objects\Factory\Xml\LocaleTests.cs" />
<Compile Include="Objects\Factory\Xml\NamespaceParserRegistryTests.cs" />
<Compile Include="Objects\Factory\Xml\ObjectFactorySectionHandlerTests.cs" />
@@ -818,6 +819,7 @@
<Content Include="Data\Spring\Objects\Factory\Xml\array-autowire.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\collectionMergingGeneric.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\collectionMerging.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\collectionConversionGeneric.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\ctor-args.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\objectNameGeneration.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\simple-constructor-arg.xml" />

View File

@@ -352,6 +352,7 @@
<Compile Include="Objects\Factory\Xml\ArrayCtorDependencyObject.cs" />
<Compile Include="Objects\Factory\Xml\CollectionMergingTests.cs" />
<Compile Include="Objects\Factory\Xml\CollectionMergingGenericTests.cs" />
<Compile Include="Objects\Factory\Xml\CollectionConversionGenericTests.cs" />
<Compile Include="Objects\Factory\Xml\LocaleTests.cs" />
<Compile Include="Objects\Factory\Xml\NamespaceParserRegistryTests.cs" />
<Compile Include="Objects\Factory\Xml\ObjectFactorySectionHandlerTests.cs" />
@@ -827,6 +828,7 @@
<Content Include="Data\Spring\Objects\Factory\Xml\array-autowire.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\collectionMergingGeneric.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\collectionMerging.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\collectionConversionGeneric.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\ctor-args.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\objectNameGeneration.xml" />
<Content Include="Data\Spring\Objects\Factory\Xml\simple-constructor-arg.xml" />