From: Kevin W. <kev...@us...> - 2004-12-07 19:59:25
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/BantamTech.SysCache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23040/src/BantamTech.SysCache Added Files: AssemblyInfo.cs BantamTech.SysCache-1.1.csproj BantamTech.SysCache.Tests-1.1.csproj SysCache.cs SysCacheFixture.cs SysCacheProvider.cs SysCacheProviderFixture.cs syscache.build syscache.config syscache.nunit Log Message: initial check-in of SysCache currently unable to fully test, as Clover.NET license and SQL Server are not on current workstation --- NEW FILE: syscache.config --- <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> </configSections> <nhibernate> <!-- <add key="hibernate.connection.pool_size" value="2" /> <add key="hibernate.use_outer_join" value="false" /> --> <!-- The valid strings for Isolation can be found in the documentation for the System.Data.IsolationLevel Enumeration documentation. Use the member names - not the values. --> <!--add key="hibernate.connection.isolation" value="ReadCommitted" /--> <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> <add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" /> <add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" /> <add key="hibernate.connection.connection_string" value="Server=localhost;initial catalog=pubs;Integrated Security=SSPI" /> <add key="hibernate.cache.provider_class" value="BantamTech.SysCache.SysCacheProvider,BantamTech.SysCache" /> <add key="hibernate.cache.use_query_cache" value="true" /> </nhibernate> <log4net> <appender name="myFile" type="log4net.Appender.FileAppender,log4net" > <param name="File" value="log.txt" /> <param name="AppendToFile" value="false" /> <layout type="log4net.Layout.PatternLayout,log4net"> <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" /> </layout> </appender> <root> <priority value="DEBUG" /> <appender-ref ref="myFile" /> </root> <logger name="NHibernate"> <level value="WARN" /> </logger> </log4net> </configuration> --- NEW FILE: SysCacheProviderFixture.cs --- #region License // // SysCache - A cache provider for NHibernate using System.Web.Caching.Cache. // Copyright (C) 2004 Bantam Technologies, LLC // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // $URL: svn://www.bantamtech.com/syscache/trunk/src/SysCacheProviderFixture.cs $ // $Id: SysCacheProviderFixture.cs,v 1.1 2004/12/07 19:59:16 kevinwilliams Exp $ // #endregion using System; using System.Collections; using NHibernate.Cache; using NUnit.Framework; namespace BantamTech.SysCache.Tests { [TestFixture] public class SysCacheProviderFixture { private ICacheProvider provider; private Hashtable props; [TestFixtureSetUp] public void FixtureSetup() { log4net.Config.DOMConfigurator.Configure(); props = new Hashtable(); props.Add( "staticExpiration", DateTime.Parse( "1/1/3000" ) ); props.Add( "priority", 2 ); } [SetUp] public void Setup() { provider = new SysCacheProvider(); } [Test] public void TestBuildCacheNullNull() { ICache cache = provider.BuildCache( null, null ); Assert.IsNotNull( cache, "no cache returned" ); } [Test] public void TestBuildCacheStringNull() { ICache cache = provider.BuildCache( "a_region", null ); Assert.IsNotNull( cache, "no cache returned" ); } [Test] public void TestBuildCacheStringICollection() { ICache cache = provider.BuildCache( "another_region", props ); Assert.IsNotNull( cache, "no cache returned" ); } [Test] public void TestNextTimestamp() { long ts = provider.NextTimestamp(); Assert.IsNotNull( ts, "no timestamp returned" ); } } } --- NEW FILE: BantamTech.SysCache.Tests-1.1.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{53E01216-76B6-4920-A386-2486ACEE5AEA}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "BantamTech.SysCache.Tests" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "BantamTech.SysCache.Tests" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> <Reference Name = "syscache" Project = "{21FB1DFD-A6A9-4C8D-B4E2-CCB2EBDF8F16}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> <Reference Name = "nunit.framework" AssemblyName = "nunit.framework" HintPath = "..\..\lib\net\1.1\nunit.framework.dll" /> <Reference Name = "log4net" AssemblyName = "log4net" HintPath = "..\..\lib\net\1.1\log4net.dll" /> <Reference Name = "NHibernate" AssemblyName = "NHibernate" HintPath = "..\..\lib\net\1.1\NHibernate.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "syscache.nunit" BuildAction = "None" /> <File RelPath = "SysCacheFixture.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "SysCacheProviderFixture.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: AssemblyInfo.cs --- using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Permissions; //------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Runtime Version: 1.1.4322.2032 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------ [assembly: AssemblyTitleAttribute("BantamTech.SysCache for Microsoft .NET Framework 1.1")] [assembly: AssemblyDescriptionAttribute("Cache provider for NHibernate using ASP.NET Cache object.")] [assembly: AssemblyCompanyAttribute("nhibernate.sourceforge.net")] [assembly: AssemblyProductAttribute("BantamTech.SysCache")] [assembly: AssemblyCopyrightAttribute("Licensed under LGPL.")] [assembly: AssemblyVersionAttribute("0.5.0.0")] [assembly: AssemblyInformationalVersionAttribute("0.5")] --- NEW FILE: syscache.nunit --- <NUnitProject> <Settings activeconfig="Debug"/> <Config name="Debug"> <assembly path="bin\Debug\BantamTech.SysCache.Tests.dll"/> </Config> <Config name="Release"> <assembly path="bin\Release\BantamTech.SysCache.Tests.dll"/> </Config> </NUnitProject> --- NEW FILE: SysCacheFixture.cs --- #region License // // SysCache - A cache provider for NHibernate using System.Web.Caching.Cache. // Copyright (C) 2004 Bantam Technologies, LLC // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // $URL: svn://www.bantamtech.com/syscache/trunk/src/SysCacheFixture.cs $ // $Id: SysCacheFixture.cs,v 1.1 2004/12/07 19:59:16 kevinwilliams Exp $ // #endregion using System; using System.Collections; using NHibernate.Cache; using NUnit.Framework; namespace BantamTech.SysCache.Tests { [TestFixture] public class SysCacheFixture { private SysCacheProvider provider; private Hashtable props; [TestFixtureSetUp] public void FixtureSetup() { log4net.Config.DOMConfigurator.Configure(); props = new Hashtable(); props.Add( "relativeExpiration", 120 ); props.Add( "priority", 4 ); provider = new SysCacheProvider(); } [Test] public void TestPut() { string key = "key1"; string value = "value"; ICache cache = provider.BuildCache( "nunit", props ); Assert.IsNotNull( cache, "no cache returned" ); Assert.IsNull( cache.Get( key ), "cache returned an item we didn't add !?!" ); cache.Put( key, value ); object item = cache.Get( key ); Assert.IsNotNull( item ); Assert.AreEqual( value, item, "didn't return the item we added" ); } [Test] public void TestRemove() { string key = "key1"; string value = "value"; ICache cache = provider.BuildCache( "nunit", props ); Assert.IsNotNull( cache, "no cache returned" ); // add the item cache.Put( key, value ); // make sure it's there object item = cache.Get( key ); Assert.IsNotNull( item, "item just added is not there" ); // remove it cache.Remove( key ); // make sure it's not there item = cache.Get( key ); Assert.IsNull( item, "item still exists in cache" ); } [Test] public void TestClear() { string key = "key1"; string value = "value"; ICache cache = provider.BuildCache( "nunit", props ); Assert.IsNotNull( cache, "no cache returned" ); // add the item cache.Put( key, value ); // make sure it's there object item = cache.Get( key ); Assert.IsNotNull( item, "couldn't find item in cache" ); // clear the cache cache.Clear(); // make sure we don't get an item item = cache.Get( key ); Assert.IsNull( item, "item still exists in cache" ); } [Test] public void TestDefaultConstructor() { ICache cache = new SysCache(); Assert.IsNotNull( cache ); } [Test] public void TestNoPropertiesConstructor() { ICache cache = new SysCache( "nunit" ); Assert.IsNotNull( cache ); } [Test] [ExpectedException( typeof( IndexOutOfRangeException ) )] public void TestPriorityOutOfRange() { Hashtable h = new Hashtable(); h.Add( "priority", 7 ); ICache cache = new SysCache( "nunit", h ); Assert.IsNotNull( cache ); } [Test] [ExpectedException( typeof( NotSupportedException ) )] public void TestDoubleException() { Hashtable h = new Hashtable(); h.Add( "staticExpiration", DateTime.Now ); h.Add( "relativeExpiration", 300 ); ICache cache = new SysCache( "nunit", h ); Assert.IsNotNull( cache ); } [Test] [ExpectedException( typeof( ArgumentOutOfRangeException ) )] public void TestHistoricStaticExpiration() { Hashtable h = new Hashtable(); h.Add( "staticExpiration", DateTime.Parse( "1/1/1980") ); ICache cache = new SysCache( "nunit", h ); Assert.IsNotNull( cache ); } [Test] [ExpectedException( typeof( ArgumentException ) )] public void TestBadStaticExpiration() { Hashtable h = new Hashtable(); h.Add( "staticExpiration", "foobar" ); ICache cache = new SysCache( "nunit", h ); Assert.IsNotNull( cache ); } [Test] [ExpectedException( typeof( ArgumentException ) )] public void TestBadRelativeExpiration() { Hashtable h = new Hashtable(); h.Add( "relativeExpiration", "foobar" ); ICache cache = new SysCache( "nunit", h ); Assert.IsNotNull( cache ); } [Test] public void TestEmptyProperties() { ICache cache = new SysCache( "nunit", new Hashtable() ); Assert.IsNotNull( cache ); } [Test] [ExpectedException( typeof( ArgumentNullException ) )] public void TestNullKeyPut() { ICache cache = new SysCache(); cache.Put( null, null ); } [Test] [ExpectedException( typeof( ArgumentNullException ) )] public void TestNullValuePut() { ICache cache = new SysCache(); cache.Put( "nunit", null ); } [Test] public void TestNullKeyGet() { ICache cache = new SysCache(); cache.Put( "nunit", "value" ); object item = cache.Get( null ); Assert.IsNull( item ); } [Test] [ExpectedException( typeof( ArgumentNullException ) )] public void TestNullKeyRemove() { ICache cache = new SysCache(); cache.Remove( null ); } } } --- NEW FILE: SysCache.cs --- #region License // // SysCache - A cache provider for NHibernate using System.Web.Caching.Cache. // Copyright (C) 2004 Bantam Technologies, LLC // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // $URL: svn://www.bantamtech.com/syscache/trunk/src/SysCache.cs $ // $Id: SysCache.cs,v 1.1 2004/12/07 19:59:16 kevinwilliams Exp $ // #endregion using System; using System.Collections; using System.Web; using System.Web.Caching; using log4net; using NHibernate.Cache; namespace BantamTech.SysCache { /// <summary> /// Pluggable cache implementation using the System.Web.Caching classes /// </summary> public class SysCache : ICache { private static readonly ILog log = LogManager.GetLogger( typeof( SysCache ) ); private string _region; private Cache _cache; private DateTime _absExpiration; private TimeSpan _slidingExpiration; private CacheItemPriority _priority; private Hashtable _map; private static readonly TimeSpan _defaultRelativeExpiration = TimeSpan.FromSeconds( 300 ); /// <summary> /// default constructor /// </summary> public SysCache() : this( null, null ) { } /// <summary> /// constructor with no properties /// </summary> /// <param name="region"></param> public SysCache( string region ) : this( region, null ) { } /// <summary> /// full constructor /// </summary> /// <param name="region"></param> /// <param name="properties">cache configuration properties</param> /// <remarks> /// There are three (3) configurable parameters: /// <ul> /// <li>staticExpiration = a specific DateTime to expire each item on</li> /// <li>relativeExpiration = number of seconds to wait before expiring each item</li> /// <li>priority = a numeric cost of expiring each item, where 1 is a low cost, 5 is the highest, and 3 is normal. Only values 1 through 5 are valid.</li> /// </ul> /// staticExpiration and relativeExpiration are exclusive - you can only specify one or the other, not both. /// All parameters are optional. The defaults are a relativeExpiration of 300 seconds and the default priority of 3. /// </remarks> /// <exception cref="IndexOutOfRangeException">The "priority" property is not between 1 and 5</exception> /// <exception cref="NotSupportedException">"staticExpiration" and "relativeExpiration" properties were both specified.</exception> /// <exception cref="ArgumentOutOfRangeException">The "staticExpiration" property is not in the future.</exception> /// <exception cref="ArgumentException">The "relativeExpiration" property could not be parsed.</exception> public SysCache( string region, IDictionary properties ) { _region = region; _map = new Hashtable(); _cache = HttpRuntime.Cache; Configure( properties ); } private void Configure( IDictionary props ) { if( props == null ) { if( log.IsDebugEnabled ) { log.Debug( "configuring cache with default values" ); } _absExpiration = Cache.NoAbsoluteExpiration; _slidingExpiration = _defaultRelativeExpiration; _priority = CacheItemPriority.Default; } else { if( props["priority"] != null ) { int priority = Convert.ToInt32( props["priority"] ); if( priority < 1 || priority > 5 ) { if( log.IsWarnEnabled ) { log.Warn( "priority value out of range: " + priority.ToString() ); } throw new IndexOutOfRangeException( "priority must be between 1 and 5" ); } _priority = (CacheItemPriority)priority; if( log.IsDebugEnabled ) { log.Debug( "new priority: " + _priority.ToString() ); } } else { _priority = CacheItemPriority.Default; } if( props["relativeExpiration"] == null && props["staticExpiration"] == null ) { if( log.IsDebugEnabled ) { log.Debug( "no expiration values given, using defaults" ); } _absExpiration = Cache.NoAbsoluteExpiration; _slidingExpiration = _defaultRelativeExpiration; return; } if( props["relativeExpiration"] != null && props["staticExpiration"] != null ) { if( log.IsWarnEnabled ) { log.Warn( "both expiration types specified" ); } throw new NotSupportedException( "staticExpiration and relativeExpiration are exclusive - specify one or the other, not both." ); } if( props["relativeExpiration"] == null && props["staticExpiration"] != null ) { DateTime exp; if( props["staticExpiration"] is DateTime ) { exp = (DateTime)props["staticExpiration"]; } else { try { exp = DateTime.Parse( props["staticExpiration"].ToString() ); } catch( Exception ex ) { if( log.IsWarnEnabled ) { log.Warn( "could not parse static expiration" ); } throw new ArgumentException( "could not parse as DateTime", "staticExpiration", ex ); } } if( exp > DateTime.Now ) { _absExpiration = exp; if( log.IsDebugEnabled ) { log.Debug( "new static expiration value: " + _absExpiration.ToString() ); } } else { if( log.IsWarnEnabled ) { log.Warn( "static expiration not a future time or date" ); } throw new ArgumentOutOfRangeException( "staticExpiration", exp.ToString(), "staticExpiration must be in the future" ); } _slidingExpiration = _defaultRelativeExpiration; } else { _absExpiration = Cache.NoAbsoluteExpiration; try { int seconds = Convert.ToInt32( props["relativeExpiration"] ); _slidingExpiration = TimeSpan.FromSeconds( seconds ); if( log.IsDebugEnabled ) { log.Debug( "new relative expiration value: " + seconds.ToString() ); } } catch( Exception ex ) { if( log.IsWarnEnabled ) { log.Warn( "error parsing relative expiration value" ); } throw new ArgumentException( "could not parse relativeException as a number of seconds", "relativeException", ex ); } } } } /// <summary></summary> /// <param name="key"></param> /// <returns></returns> public object Get( object key ) { if( key == null ) { return null; } return _cache.Get( key.ToString() ); } /// <summary></summary> /// <param name="key"></param> /// <param name="value"></param> public void Put( object key, object value ) { if( key == null ) { throw new ArgumentNullException( "key", "null key not allowed" ); } if( value == null ) { throw new ArgumentNullException( "value", "null value not allowed" ); } if( _cache[key.ToString()] != null ) { if( log.IsDebugEnabled ) { log.Debug( "updating value of key '" + key.ToString() + "' to: " + value.ToString() ); } _cache[key.ToString()] = value; } else { if( log.IsDebugEnabled ) { log.Debug( "adding new data: key=" + key.ToString() + "&value=" + value.ToString() ); } _map.Add( key.ToString(), value ); _cache.Add( key.ToString(), value, null, _absExpiration, _slidingExpiration, _priority, null ); } } /// <summary></summary> /// <param name="key"></param> public void Remove( object key ) { if( key == null ) { throw new ArgumentNullException( "key" ); } _map.Remove( key.ToString() ); _cache.Remove( key.ToString() ); } /// <summary></summary> public void Clear() { foreach( DictionaryEntry entry in _map ) { _cache.Remove( entry.Key.ToString() ); } _map.Clear(); } /// <summary></summary> public void Destroy() { Clear(); } /// <summary></summary> public string Region { set { _region = value; } } } } --- NEW FILE: SysCacheProvider.cs --- #region License // // SysCache - A cache provider for NHibernate using System.Web.Caching.Cache. // Copyright (C) 2004 Bantam Technologies, LLC // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // $URL: svn://www.bantamtech.com/syscache/trunk/src/SysCacheProvider.cs $ // $Id: SysCacheProvider.cs,v 1.1 2004/12/07 19:59:16 kevinwilliams Exp $ // #endregion using System; using System.Collections; using System.Text; using log4net; using NHibernate.Cache; namespace BantamTech.SysCache { /// <summary> /// Cache provider using the System.Web.Caching classes /// </summary> public class SysCacheProvider : ICacheProvider { private static readonly ILog log = LogManager.GetLogger( typeof( SysCacheProvider ) ); /// <summary> /// build a new SysCache /// </summary> /// <param name="regionName"></param> /// <param name="properties"></param> /// <returns></returns> [CLSCompliant(false)] public ICache BuildCache( string regionName, IDictionary properties ) { if( log.IsDebugEnabled ) { if( regionName == null ) { regionName = ""; } if( properties == null ) { properties = new Hashtable(); } StringBuilder sb = new StringBuilder(); foreach( DictionaryEntry de in properties ) { sb.Append( "name=" ); sb.Append( de.Key.ToString() ); sb.Append( "&value=" ); sb.Append( de.Value.ToString() ); sb.Append( ";" ); } log.Debug( "building cache with region: " + regionName + ", properties: " + sb.ToString() ); } return new SysCache( regionName, properties ); } /// <summary></summary> /// <returns></returns> public long NextTimestamp() { return Timestamper.Next(); } } } --- NEW FILE: BantamTech.SysCache-1.1.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{21FB1DFD-A6A9-4C8D-B4E2-CCB2EBDF8F16}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "BantamTech.SysCache" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "BantamTech.SysCache" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "BantamTech.SysCache.xml" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "BantamTech.SysCache.xml" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> <Reference Name = "System.Web" AssemblyName = "System.Web" HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Web.dll" /> <Reference Name = "NHibernate" AssemblyName = "NHibernate" HintPath = "..\..\lib\net\1.1\NHibernate.dll" /> <Reference Name = "log4net" AssemblyName = "log4net" HintPath = "..\..\lib\net\1.1\log4net.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "SysCache.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "SysCacheProvider.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: syscache.build --- <?xml version="1.0"?> <project name="BantamTech.SysCache" default="build" description="NHibernate pluggable cache provider using ASP.NET Cache object" xmlns="http://nant.sourceforge.net/schemas/nant-0.84.win32.net-1.0.xsd"> <!-- Required properties: * build.dir - (path) root level to build to, assemblies will go in ${build.dir}/bin * build.debug - (true|false) debug build? * current.build.defines - framework-specific build defines * project.version - full project version * project.version.major - the major number of the build * project.version.minor - the minor number of the build * project.version.build - the build number * sign - (true|false)indicates if the Assembly should be signed. * clover.enabled - (true|false) indicates if Clover.NET should handle the build * clover.src - location of the clovered source to be stored at from the root of NHibernateContrib * clover.db - location of the coverage db from the root of NHibernateContrib --> <!--if propertytrue="clover.enabled"> <loadtasks assembly="${clover.home}/CloverNAnt-0.84.dll" /> </if--> <property name="keyFile" value="..\NHibernate.snk" /> <target name="build"> <attrib file="AssemblyInfo.cs" readonly="false" /> <asminfo output="AssemblyInfo.cs" language="CSharp"> <imports> <import name="System" /> <import name="System.Reflection" /> <import name="System.Runtime.CompilerServices" /> <import name="System.Runtime.InteropServices" /> <import name="System.Security.Permissions" /> </imports> <attributes> <attribute type="AssemblyTitleAttribute" value="${nant.project.name} for ${current.runtime.description}" /> <attribute type="AssemblyDescriptionAttribute" value="Cache provider for NHibernate using ASP.NET Cache object." /> <attribute type="AssemblyCompanyAttribute" value="nhibernate.sourceforge.net" /> <attribute type="AssemblyProductAttribute" value="${nant.project.name}" /> <attribute type="AssemblyCopyrightAttribute" value="Licensed under LGPL." /> <attribute type="AssemblyVersionAttribute" value="${project.version}" /> <attribute type="AssemblyInformationalVersionAttribute" value="${project.version.major}.${project.version.minor}" /> <attribute type="AssemblyKeyFileAttribute" value="${keyFile}" if="${sign}" /> </attributes> </asminfo> <csc output="${build.dir}/bin/${nant.project.name}.dll" doc="${build.dir}/bin/${nant.project.name}.xml" target="library" debug="${build.debug}" define="${current.build.defines}" optimize="true" > <sources> <excludes name="**/*Fixture.cs" /> <includes name="**/*.cs" /> </sources> <references> <includes name="System.dll" /> <includes name="System.Data.dll" /> <includes name="System.Web.dll" /> <includes name="System.XML.dll" /> <includes name="${build.dir}/bin/NHibernate.dll" /> <includes name="${build.dir}/bin/log4net.dll" /> </references> </csc> <csc output="${build.dir}/bin/${nant.project.name}.Tests.dll" target="library" debug="${build.debug}" define="${current.build.defines}" optimize="true" > <sources> <includes name="**/AssemblyInfo.cs" /> <includes name="**/*Fixture.cs" /> </sources> <references> <includes name="System.dll" /> <includes name="System.Data.dll" /> <includes name="System.XML.dll" /> <includes name="${build.dir}/bin/${nant.project.name}.dll" /> <includes name="${build.dir}/bin/NHibernate.dll" /> <includes name="${build.dir}/bin/nunit.framework.dll" /> <includes name="${build.dir}/bin/log4net.dll" /> </references> </csc> </target> <target name="test" depends="build" description="run unit tests"> <copy file="syscache.config" tofile="${build.dir}/bin/${nant.project.name}.dll.config" /> <nunit2 failonerror="false"> <formatter type="Xml" usefile="true" extension=".xml" outputdir="${build.dir}/bin" /> <test assemblyname="${build.dir}/bin/${nant.project.name}.Tests.dll" appconfig="${build.dir}/syscache.config" /> </nunit2> </target> </project> |