From 3dc13bec2f420e6c08e2be67db0fcc0d1fe65478 Mon Sep 17 00:00:00 2001 From: lahma Date: Sat, 26 Dec 2009 20:19:39 +0000 Subject: [PATCH] SPRNET-1246: Show DI for NHibernate managed objects in NHibernate example application --- Spring.Net.2008.sln | 36 +++++++++ .../Debug.Spring.Northwind.sln | 40 +++------- .../Debug.Web.Spring.Northwind.sln | 34 ++++----- .../Spring.Northwind.2008.sln | 2 +- .../Spring.Northwind.sln | 2 +- .../Dao/Dao.xml | 12 ++- .../CustomLocalSessionFactoryObject.cs | 23 ++++++ .../Mappings/Customer.hbm.xml | 26 ++++--- .../Mappings/Order.hbm.xml | 2 +- ...pring.Northwind.Dao.NHibernate.2008.csproj | 5 +- .../Spring.Northwind.Dao.NHibernate.csproj | 5 +- .../Spring.Northwind.Dao/Domain/Customer.cs | 35 ++++++--- ...DefaultCustomerClassificationCalculator.cs | 47 ++++++++++++ .../Spring.Northwind.Dao/Domain/ICustomer.cs | 24 ++++++ .../ICustomerClassificationCalculator.cs | 14 ++++ .../src/Spring.Northwind.Dao/Domain/Order.cs | 23 +++--- .../Domain/OrderDetail.cs | 8 +- .../Spring.Northwind.Dao.2008.csproj | 5 +- .../Spring.Northwind.Dao.csproj | 3 + .../Properties/AssemblyInfo.cs | 13 +++- ...pring.Northwind.Web.References.2008.csproj | 73 +++++++++++++++---- .../Spring.Northwind.Web.References.csproj | 7 +- .../src/Spring.Northwind.Web/CSS/style.css | 1 + .../Spring.Northwind.Web/CustomerList.aspx | 5 ++ .../CustomerOrders.aspx.cs | 3 + .../FulfillmentResult.aspx.cs | 3 - .../NorthwindIntegrationTests.cs | 2 +- 27 files changed, 335 insertions(+), 118 deletions(-) create mode 100644 examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/CustomLocalSessionFactoryObject.cs create mode 100644 examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/DefaultCustomerClassificationCalculator.cs create mode 100644 examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/ICustomer.cs create mode 100644 examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/ICustomerClassificationCalculator.cs diff --git a/Spring.Net.2008.sln b/Spring.Net.2008.sln index 85f7980f..f7a61466 100644 --- a/Spring.Net.2008.sln +++ b/Spring.Net.2008.sln @@ -64,6 +64,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Template.Velocity.20 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Template.Velocity.Tests", "test\Spring\Spring.Template.Velocity.Tests\Spring.Template.Velocity.Tests.csproj", "{10405837-CB67-40D8-9326-84C9383983E2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate30.2008", "src\Spring\Spring.Data.NHibernate30\Spring.Data.NHibernate30.2008.csproj", "{009247FE-CBAD-40FF-ADC3-D7F28B270071}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate30.Tests.2008", "test\Spring\Spring.Data.NHibernate30.Tests\Spring.Data.NHibernate30.Tests.2008.csproj", "{E4CCB8A2-2381-41D1-B44C-E20E13703056}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate21.Integration.Tests.2008", "test\Spring\Spring.Data.NHibernate21.Integration.Tests\Spring.Data.NHibernate21.Integration.Tests.2008.csproj", "{4A07E150-ED90-407C-8CAD-4760444DDFD9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -374,6 +380,36 @@ Global {10405837-CB67-40D8-9326-84C9383983E2}.Release|Any CPU.Build.0 = Release|Any CPU {10405837-CB67-40D8-9326-84C9383983E2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {10405837-CB67-40D8-9326-84C9383983E2}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|.NET.ActiveCfg = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|Any CPU.Build.0 = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Release|.NET.ActiveCfg = Release|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Release|Any CPU.ActiveCfg = Release|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Release|Any CPU.Build.0 = Release|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {009247FE-CBAD-40FF-ADC3-D7F28B270071}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|.NET.ActiveCfg = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Release|.NET.ActiveCfg = Release|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Release|Any CPU.Build.0 = Release|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E4CCB8A2-2381-41D1-B44C-E20E13703056}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|.NET.ActiveCfg = Debug|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|.NET.ActiveCfg = Release|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Any CPU.Build.0 = Release|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A07E150-ED90-407C-8CAD-4760444DDFD9}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/Debug.Spring.Northwind.sln b/examples/Spring/Spring.Data.NHibernate.Northwind/Debug.Spring.Northwind.sln index fa5a7288..bb9a25df 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/Debug.Spring.Northwind.sln +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/Debug.Spring.Northwind.sln @@ -25,12 +25,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Northwind.Integratio Release.AspNetCompiler.Debug = "False" EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Aspects", "src\Spring.Aspects\Spring.Aspects.csproj", "{53B04C54-63EA-45AA-BB83-8950AF3C5D68}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.2005", "..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj", "{710961A3-0DF4-49E4-A26E-F5B9C044AC84}" ProjectSection(WebsiteProperties) = preProject Debug.AspNetCompiler.Debug = "True" @@ -55,13 +49,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.2005", "..\..\. Release.AspNetCompiler.Debug = "False" EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate.2005", "..\..\..\src\Spring\Spring.Data.NHibernate\Spring.Data.NHibernate.2005.csproj", "{130E1609-45A7-4F65-B112-105F2DD3E2CE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.2005", "..\..\..\src\Spring\Spring.Web\Spring.Web.2005.csproj", "{BA4789EB-281A-48EA-8763-28B9F0596A18}" ProjectSection(WebsiteProperties) = preProject Debug.AspNetCompiler.Debug = "True" Release.AspNetCompiler.Debug = "False" EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.2005", "..\..\..\src\Spring\Spring.Web\Spring.Web.2005.csproj", "{BA4789EB-281A-48EA-8763-28B9F0596A18}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate21.2005", "..\..\..\src\Spring\Spring.Data.NHibernate21\Spring.Data.NHibernate21.2005.csproj", "{E57B4652-0231-49CB-B058-87E10EFE540D}" ProjectSection(WebsiteProperties) = preProject Debug.AspNetCompiler.Debug = "True" Release.AspNetCompiler.Debug = "False" @@ -117,16 +111,6 @@ Global {2D0C5DF7-3BDB-44FB-BC1B-58E60B170BAD}.Release|Any CPU.Build.0 = Release|Any CPU {2D0C5DF7-3BDB-44FB-BC1B-58E60B170BAD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {2D0C5DF7-3BDB-44FB-BC1B-58E60B170BAD}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|.NET.ActiveCfg = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|.NET.ActiveCfg = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|Any CPU.ActiveCfg = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|Any CPU.Build.0 = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|Mixed Platforms.Build.0 = Release|Any CPU {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|.NET.ActiveCfg = Debug|Any CPU {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -157,16 +141,6 @@ Global {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Any CPU.Build.0 = Release|Any CPU {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Debug|.NET.ActiveCfg = Debug|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Release|.NET.ActiveCfg = Release|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Release|Any CPU.Build.0 = Release|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {130E1609-45A7-4F65-B112-105F2DD3E2CE}.Release|Mixed Platforms.Build.0 = Release|Any CPU {BA4789EB-281A-48EA-8763-28B9F0596A18}.Debug|.NET.ActiveCfg = Debug|Any CPU {BA4789EB-281A-48EA-8763-28B9F0596A18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BA4789EB-281A-48EA-8763-28B9F0596A18}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -177,6 +151,16 @@ Global {BA4789EB-281A-48EA-8763-28B9F0596A18}.Release|Any CPU.Build.0 = Release|Any CPU {BA4789EB-281A-48EA-8763-28B9F0596A18}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {BA4789EB-281A-48EA-8763-28B9F0596A18}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Debug|.NET.ActiveCfg = Debug|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Release|.NET.ActiveCfg = Release|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Release|Any CPU.Build.0 = Release|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {E57B4652-0231-49CB-B058-87E10EFE540D}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/Debug.Web.Spring.Northwind.sln b/examples/Spring/Spring.Data.NHibernate.Northwind/Debug.Web.Spring.Northwind.sln index cb2364d1..f7490d99 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/Debug.Web.Spring.Northwind.sln +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/Debug.Web.Spring.Northwind.sln @@ -18,7 +18,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "C:\...\Spring.Northwind.Web Release.AspNetCompiler.ForceOverwrite = "true" Release.AspNetCompiler.FixedNames = "false" Release.AspNetCompiler.Debug = "False" - VWDPort = "17866" + VWDPort = "8642" DefaultWebSiteLanguage = "Visual C#" EndProjectSection EndProject @@ -46,12 +46,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Northwind.Integratio Release.AspNetCompiler.Debug = "False" EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Aspects", "src\Spring.Aspects\Spring.Aspects.csproj", "{53B04C54-63EA-45AA-BB83-8950AF3C5D68}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Northwind.Web.References.Debug", "src\Spring.Northwind.Web.References\Spring.Northwind.Web.References.Debug.csproj", "{FD89FEBE-4914-45F3-9123-B2CB954810DD}" ProjectSection(WebsiteProperties) = preProject Debug.AspNetCompiler.Debug = "True" @@ -94,6 +88,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate12.20 Release.AspNetCompiler.Debug = "False" EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Aop.2005", "..\..\..\src\Spring\Spring.Aop\Spring.Aop.2005.csproj", "{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -154,16 +154,6 @@ Global {2D0C5DF7-3BDB-44FB-BC1B-58E60B170BAD}.Release|Any CPU.Build.0 = Release|Any CPU {2D0C5DF7-3BDB-44FB-BC1B-58E60B170BAD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {2D0C5DF7-3BDB-44FB-BC1B-58E60B170BAD}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|.NET.ActiveCfg = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|Any CPU.Build.0 = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|.NET.ActiveCfg = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|Any CPU.ActiveCfg = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|Any CPU.Build.0 = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {53B04C54-63EA-45AA-BB83-8950AF3C5D68}.Release|Mixed Platforms.Build.0 = Release|Any CPU {FD89FEBE-4914-45F3-9123-B2CB954810DD}.Debug|.NET.ActiveCfg = Debug|Any CPU {FD89FEBE-4914-45F3-9123-B2CB954810DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD89FEBE-4914-45F3-9123-B2CB954810DD}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -234,6 +224,16 @@ Global {90F2D070-6F98-4926-A626-BD7A6071D6D9}.Release|Any CPU.Build.0 = Release|Any CPU {90F2D070-6F98-4926-A626-BD7A6071D6D9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {90F2D070-6F98-4926-A626-BD7A6071D6D9}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|.NET.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|.NET.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.Build.0 = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/Spring.Northwind.2008.sln b/examples/Spring/Spring.Data.NHibernate.Northwind/Spring.Northwind.2008.sln index c9b7f879..5eeee345 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/Spring.Northwind.2008.sln +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/Spring.Northwind.2008.sln @@ -19,7 +19,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Spring.Northwind.Web", "src Release.AspNetCompiler.ForceOverwrite = "true" Release.AspNetCompiler.FixedNames = "false" Release.AspNetCompiler.Debug = "False" - VWDPort = "1135" + VWDPort = "8158" DefaultWebSiteLanguage = "Visual C#" EndProjectSection EndProject diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/Spring.Northwind.sln b/examples/Spring/Spring.Data.NHibernate.Northwind/Spring.Northwind.sln index 1bc6642b..0ff5c5a9 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/Spring.Northwind.sln +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/Spring.Northwind.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "L:\...\Spring.Northwind.Web\", "src\Spring.Northwind.Web\", "{3E321CBC-75B0-45C4-AFEF-7CEED28368AE}" ProjectSection(WebsiteProperties) = preProject - ProjectReferences = "{53B04C54-63EA-45AA-BB83-8950AF3C5D68}|Spring.Aspects.dll;{7F45EEA2-50AC-44E2-85A6-2FFB02E38C44}|Spring.Northwind.Dao.dll;{6E4F55A0-C281-4706-A08B-BDEC2D2FBDA4}|Spring.Northwind.Dao.NHibernate.dll;{9E15876F-E9E0-43B7-9874-B54F163757D6}|Spring.Northwind.Service.dll;{FD89FEBE-4914-45F3-9123-B2CB954810DD}|Spring.Northwind.Web.References.dll;" + ProjectReferences = "{7F45EEA2-50AC-44E2-85A6-2FFB02E38C44}|Spring.Northwind.Dao.dll;{6E4F55A0-C281-4706-A08B-BDEC2D2FBDA4}|Spring.Northwind.Dao.NHibernate.dll;{9E15876F-E9E0-43B7-9874-B54F163757D6}|Spring.Northwind.Service.dll;{FD89FEBE-4914-45F3-9123-B2CB954810DD}|Spring.Northwind.Web.References.dll;" Debug.AspNetCompiler.VirtualPath = "/Spring.Northwind.Web" Debug.AspNetCompiler.PhysicalPath = "src\Spring.Northwind.Web\" Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.Northwind.Web\" diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/Dao.xml b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/Dao.xml index 844585c1..fcc56048 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/Dao.xml +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/Dao.xml @@ -18,7 +18,7 @@ connectionString="Data Source=|DataDirectory|Northwind.db;Version=3;FailIfMissing=True;"/> - + @@ -30,13 +30,13 @@ + - @@ -60,5 +60,13 @@ + + + + + + + + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/CustomLocalSessionFactoryObject.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/CustomLocalSessionFactoryObject.cs new file mode 100644 index 00000000..b955c5fb --- /dev/null +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Dao/NHibernate/CustomLocalSessionFactoryObject.cs @@ -0,0 +1,23 @@ +using NHibernate.Bytecode; + +using Spring.Data.NHibernate; +using Spring.Data.NHibernate.Bytecode; + +namespace Spring.Northwind.Dao.NHibernate +{ + /// + /// A custom version of that sets + /// bytecode provider to be Spring.NET's . + /// + public class CustomLocalSessionFactoryObject : LocalSessionFactoryObject + { + /// + /// Overwritten to return Spring's bytecode provider for entity injection to work. + /// + public override IBytecodeProvider BytecodeProvider + { + get { return new BytecodeProvider(ApplicationContext); } + set { } + } + } +} \ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Mappings/Customer.hbm.xml b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Mappings/Customer.hbm.xml index 35e47d9c..ef049d33 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Mappings/Customer.hbm.xml +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Mappings/Customer.hbm.xml @@ -1,41 +1,43 @@  - - + + + + - + - + - + - + - + - + - + - + - + - + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Mappings/Order.hbm.xml b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Mappings/Order.hbm.xml index a37c304e..8c8d6b0b 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Mappings/Order.hbm.xml +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Mappings/Order.hbm.xml @@ -38,7 +38,7 @@ - + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.2008.csproj b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.2008.csproj index 19b08694..18715246 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.2008.csproj +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.2008.csproj @@ -33,9 +33,9 @@ 4 - + False - ..\..\..\..\..\bin\net\2.0\debug\Common.Logging.dll + ..\..\..\..\..\lib\Net\2.0\Common.Logging.dll False @@ -67,6 +67,7 @@ + Code diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.csproj b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.csproj index be4d53de..52e62d33 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.csproj +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao.NHibernate/Spring.Northwind.Dao.NHibernate.csproj @@ -28,9 +28,9 @@ 4 - + False - ..\..\..\..\..\bin\net\2.0\debug\Common.Logging.dll + ..\..\..\..\..\lib\Net\2.0\Common.Logging.dll False @@ -66,6 +66,7 @@ + Code diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/Customer.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/Customer.cs index 89970834..c2ecc7c7 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/Customer.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/Customer.cs @@ -18,11 +18,16 @@ #endregion -using System.Collections; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; namespace Spring.Northwind.Domain { - public class Customer + /// + /// Customer entity. We + /// + public class Customer : ICustomer { #region Fields @@ -37,8 +42,11 @@ namespace Spring.Northwind.Domain protected string country; protected string phone; protected string fax; - protected IList orders; + protected IList orders; + // our calculator that is injected by Spring + private readonly ICustomerClassificationCalculator calculator; + #endregion #region Properties @@ -109,25 +117,30 @@ namespace Spring.Northwind.Domain set { fax = value; } } - public IList Orders + public ReadOnlyCollection Orders { get { - if (orders == null) - { - orders = new ArrayList(); - } - return orders; + return new ReadOnlyCollection(orders ?? new List(0)); } - set { orders = value; } + } + + public string Classification + { + get { return calculator.CalculateClassification(this); } } #endregion #region Constructor (s) - public Customer() + public Customer(ICustomerClassificationCalculator calculator) { + if (calculator == null) + { + throw new ArgumentNullException("calculator", "Calculator cannot be null"); + } + this.calculator = calculator; } public Customer(string companyName, string contactName, string contactTitle, string address, string city, diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/DefaultCustomerClassificationCalculator.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/DefaultCustomerClassificationCalculator.cs new file mode 100644 index 00000000..06413824 --- /dev/null +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/DefaultCustomerClassificationCalculator.cs @@ -0,0 +1,47 @@ +using System; + +namespace Spring.Northwind.Domain +{ + /// + /// Basic (dummy) implementation of customer classification calculation. + /// + /// + /// In real life we would need to check orders, their total and the actual + /// reveneu that this customer brings us.. + /// + public class DefaultCustomerClassificationCalculator : ICustomerClassificationCalculator + { + + public string CalculateClassification(Customer customer) + { + if (customer == null) + { + return null; + } + + // we calculate based on customer's A alphabet cout (of course) + int aCount = 0; + foreach (char c in customer.CompanyName) + { + if (Char.ToLowerInvariant(c) == 'a') + { + aCount++; + } + } + + if (aCount > 4) + { + // great customer! + return "A"; + } + if (aCount > 1) + { + // ok.. + return "B"; + } + + // a really lousy customer... + return "C"; + } + } +} \ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/ICustomer.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/ICustomer.cs new file mode 100644 index 00000000..36061efd --- /dev/null +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/ICustomer.cs @@ -0,0 +1,24 @@ +using System.Collections.ObjectModel; + +namespace Spring.Northwind.Domain +{ + /// + /// Interface for customer entity data. + /// + public interface ICustomer + { + string Id { get; } + string CompanyName { get; set; } + string ContactName { get; set; } + string ContactTitle { get; set; } + string Address { get; set; } + string City { get; set; } + string Region { get; set; } + string PostalCode { get; set; } + string Country { get; set; } + string Phone { get; set; } + string Fax { get; set; } + ReadOnlyCollection Orders { get; } + string Classification { get; } + } +} \ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/ICustomerClassificationCalculator.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/ICustomerClassificationCalculator.cs new file mode 100644 index 00000000..be55e7a6 --- /dev/null +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/ICustomerClassificationCalculator.cs @@ -0,0 +1,14 @@ +namespace Spring.Northwind.Domain +{ + public interface ICustomerClassificationCalculator + { + /// + /// Calculates the classification of customer (the value of customer to our company). + /// + /// + /// Customer to base calculation on. + /// + /// Human readable classifcation indicator for given customer. + string CalculateClassification(Customer customer); + } +} \ No newline at end of file diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/Order.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/Order.cs index 468f7137..a40fc0c5 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/Order.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/Order.cs @@ -19,7 +19,8 @@ #endregion using System; -using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; namespace Spring.Northwind.Domain { @@ -42,7 +43,9 @@ namespace Spring.Northwind.Domain //protected Employee _employee; //protected Shipper _shipVia; - protected IList orderDetails; + protected IList orderDetails; + + protected ICustomerClassificationCalculator calculator; #endregion @@ -54,7 +57,7 @@ namespace Spring.Northwind.Domain public Order(DateTime orderDate, DateTime requiredDate, DateTime shippedDate, decimal freight, string shipName, string shipAddress, string shipCity, string shipRegion, string shipPostalCode, string shipCountry, - Customer customer) + Customer customer, ICustomerClassificationCalculator calculator) { this.orderDate = orderDate; this.requiredDate = requiredDate; @@ -67,6 +70,7 @@ namespace Spring.Northwind.Domain this.shipPostalCode = shipPostalCode; this.shipCountry = shipCountry; this.customer = customer; + this.calculator = calculator; } #endregion @@ -146,18 +150,9 @@ namespace Spring.Northwind.Domain set { customer = value; } } - - public IList OrderDetails + public ReadOnlyCollection OrderDetails { - get - { - if(orderDetails == null) - { - orderDetails = new ArrayList(); - } - return orderDetails; - } - set { orderDetails = value; } + get { return new ReadOnlyCollection(orderDetails ?? new List()); } } #endregion diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/OrderDetail.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/OrderDetail.cs index 0c0617bc..afc893ae 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/OrderDetail.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Domain/OrderDetail.cs @@ -24,9 +24,9 @@ namespace Spring.Northwind.Domain { public class OrderDetail { - protected double unitPrice; + protected decimal unitPrice; protected int quantity; - protected double discount; + protected decimal discount; protected Order order; protected int productId; //protected Product product; @@ -44,7 +44,7 @@ namespace Spring.Northwind.Domain return order.Id.GetHashCode() + 29*productId.GetHashCode(); } - public double UnitPrice + public decimal UnitPrice { get { return this.unitPrice; } set { this.unitPrice = value; } @@ -56,7 +56,7 @@ namespace Spring.Northwind.Domain set { this.quantity = value; } } - public double Discount + public decimal Discount { get { return this.discount; } set { this.discount = value; } diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Spring.Northwind.Dao.2008.csproj b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Spring.Northwind.Dao.2008.csproj index abcd0f59..3d889f3e 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Spring.Northwind.Dao.2008.csproj +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Spring.Northwind.Dao.2008.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 2.0 {7F45EEA2-50AC-44E2-85A6-2FFB02E38C44} Library @@ -43,6 +43,9 @@ + + + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Spring.Northwind.Dao.csproj b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Spring.Northwind.Dao.csproj index f34633b5..2b60e336 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Spring.Northwind.Dao.csproj +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Dao/Spring.Northwind.Dao.csproj @@ -38,6 +38,9 @@ + + + diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web.References/Properties/AssemblyInfo.cs b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web.References/Properties/AssemblyInfo.cs index ff14b9d5..89d1ea93 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web.References/Properties/AssemblyInfo.cs +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web.References/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -31,8 +30,18 @@ using System.Runtime.InteropServices; [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] +#pragma warning disable 414 class LinkThem { private Spring.Data.NHibernate.HibernateTemplate ht = null; private Spring.Web.UI.Page page = null; -} \ No newline at end of file + private Common.Logging.ILog log = null; + + public LinkThem(Spring.Data.NHibernate.HibernateTemplate ht, Spring.Web.UI.Page page, Common.Logging.ILog log) + { + this.ht = ht; + this.page = page; + this.log = log; + } +} +#pragma warning restore 414 diff --git a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web.References/Spring.Northwind.Web.References.2008.csproj b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web.References/Spring.Northwind.Web.References.2008.csproj index 952ca6fb..fe51038f 100644 --- a/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web.References/Spring.Northwind.Web.References.2008.csproj +++ b/examples/Spring/Spring.Data.NHibernate.Northwind/src/Spring.Northwind.Web.References/Spring.Northwind.Web.References.2008.csproj @@ -14,6 +14,21 @@ 2.0 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true true @@ -33,53 +48,54 @@ 4 - + False ..\..\..\..\..\lib\NHibernate21\net\2.0\Antlr3.Runtime.dll - + False ..\..\..\..\..\bin\net\2.0\debug\Common.Logging.dll + True - + False ..\..\lib\net\2.0\Common.Logging.Log4Net.dll - + False ..\..\..\..\..\lib\NHibernate21\net\2.0\Iesi.Collections.dll - - False - ..\..\..\..\..\lib\NHibernate21\net\2.0\log4net.dll - - + False ..\..\..\..\..\lib\NHibernate21\net\2.0\NHibernate.dll - + + False + ..\..\..\..\..\bin\net\2.0\debug\Spring.Aop.dll + + False ..\..\..\..\..\bin\net\2.0\debug\Spring.Core.dll - + False ..\..\..\..\..\bin\net\2.0\debug\Spring.Data.dll - + False ..\..\..\..\..\bin\net\2.0\debug\Spring.Data.NHibernate21.dll - + False ..\..\..\..\..\bin\net\2.0\debug\Spring.Web.dll - + + False ..\..\lib\net\2.0\System.Data.SQLite.DLL - @@ -87,6 +103,33 @@ Code + + + False + .NET Framework Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + +