From: <fab...@us...> - 2010-07-27 17:52:10
|
Revision: 5062 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5062&view=rev Author: fabiomaulo Date: 2010-07-27 17:52:03 +0000 (Tue, 27 Jul 2010) Log Message: ----------- SchemaExport supporting auto-quote configuration Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaExportTests/AutoQuoteFixture.cs Modified: trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs 2010-07-27 17:08:22 UTC (rev 5061) +++ trunk/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs 2010-07-27 17:52:03 UTC (rev 5062) @@ -55,6 +55,13 @@ { return; } + string autoKeyWordsImport = PropertiesHelper.GetString(Environment.Hbm2ddlKeyWords, configProperties, "not-defined"); + autoKeyWordsImport = autoKeyWordsImport.ToLowerInvariant(); + if (autoKeyWordsImport == Hbm2DDLKeyWords.AutoQuote) + { + SchemaMetadataUpdater.QuoteTableAndColumns(cfg); + } + dialect = Dialect.Dialect.GetDialect(configProperties); dropSQL = cfg.GenerateDropSchemaScript(dialect); createSQL = cfg.GenerateSchemaCreationScript(dialect); Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-27 17:08:22 UTC (rev 5061) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-27 17:52:03 UTC (rev 5062) @@ -1434,6 +1434,7 @@ <Compile Include="SqlTest\SqlTypeFactoryFixture.cs" /> <Compile Include="Stateless\Naturalness.cs" /> <Compile Include="Stateless\StatelessWithRelationsFixture.cs" /> + <Compile Include="Tools\hbm2ddl\SchemaExportTests\AutoQuoteFixture.cs" /> <Compile Include="Tools\hbm2ddl\SchemaExportTests\WithColumnTag.cs" /> <Compile Include="Tools\hbm2ddl\SchemaExportTests\WithColumnTagFixture.cs" /> <Compile Include="Tools\hbm2ddl\SchemaMetadataUpdaterTest\HeavyEntity.cs" /> Added: trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaExportTests/AutoQuoteFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaExportTests/AutoQuoteFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Tools/hbm2ddl/SchemaExportTests/AutoQuoteFixture.cs 2010-07-27 17:52:03 UTC (rev 5062) @@ -0,0 +1,31 @@ +using System.Text; +using NHibernate.Cfg; +using NHibernate.Dialect; +using NHibernate.Tool.hbm2ddl; +using NUnit.Framework; +using SharpTestsEx; + +namespace NHibernate.Test.Tools.hbm2ddl.SchemaExportTests +{ + public class AutoQuoteFixture + { + [Test] + public void WhenCalledExplicitlyThenTakeInAccountHbm2DdlKeyWordsSetting() + { + var configuration = TestConfigurationHelper.GetDefaultConfiguration(); + var dialect = NHibernate.Dialect.Dialect.GetDialect(configuration.Properties); + if(!(dialect is MsSql2000Dialect)) + { + Assert.Ignore(GetType() + " does not apply to " + dialect); + } + + configuration.SetProperty(Environment.Hbm2ddlKeyWords, "auto-quote"); + configuration.AddResource("NHibernate.Test.Tools.hbm2ddl.SchemaMetadataUpdaterTest.HeavyEntity.hbm.xml", + GetType().Assembly); + + var script = new StringBuilder(); + new SchemaExport(configuration).Execute(s=> script.AppendLine(s), false, false); + script.ToString().Should().Contain("[Order]").And.Contain("[Select]").And.Contain("[From]").And.Contain("[And]"); + } + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |