You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <fab...@us...> - 2011-03-20 17:43:32
|
Revision: 5478 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5478&view=rev Author: fabiomaulo Date: 2011-03-20 17:43:25 +0000 (Sun, 20 Mar 2011) Log Message: ----------- Changed IProxyFactory to get the instance to wrap, for proxy "field-interceptor" Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Proxy/AbstractProxyFactory.cs trunk/nhibernate/src/NHibernate/Proxy/DefaultProxyFactory.cs trunk/nhibernate/src/NHibernate/Proxy/IProxyFactory.cs trunk/nhibernate/src/NHibernate/Proxy/Map/MapProxyFactory.cs trunk/nhibernate/src/NHibernate/Tuple/PocoInstantiator.cs trunk/nhibernate/src/NHibernate.ByteCode.Castle/ProxyFactory.cs trunk/nhibernate/src/NHibernate.ByteCode.Castle.Tests/LazyFieldInterceptorSerializable.cs Modified: trunk/nhibernate/src/NHibernate/Proxy/AbstractProxyFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/AbstractProxyFactory.cs 2011-03-20 17:31:14 UTC (rev 5477) +++ trunk/nhibernate/src/NHibernate/Proxy/AbstractProxyFactory.cs 2011-03-20 17:43:25 UTC (rev 5478) @@ -44,7 +44,7 @@ public abstract INHibernateProxy GetProxy(object id, ISessionImplementor session); - public virtual object GetFieldInterceptionProxy() + public virtual object GetFieldInterceptionProxy(object instanceToWrap) { throw new NotSupportedException(); } Modified: trunk/nhibernate/src/NHibernate/Proxy/DefaultProxyFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DefaultProxyFactory.cs 2011-03-20 17:31:14 UTC (rev 5477) +++ trunk/nhibernate/src/NHibernate/Proxy/DefaultProxyFactory.cs 2011-03-20 17:43:25 UTC (rev 5478) @@ -30,10 +30,9 @@ } } - public override object GetFieldInterceptionProxy() + public override object GetFieldInterceptionProxy(object instanceToWrap) { - object targetInstance = Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(PersistentClass, true); - var interceptor = new DefaultDynamicLazyFieldInterceptor(targetInstance); + var interceptor = new DefaultDynamicLazyFieldInterceptor(instanceToWrap); return factory.CreateProxy(PersistentClass, interceptor, new[] { typeof(IFieldInterceptorAccessor) }); } } Modified: trunk/nhibernate/src/NHibernate/Proxy/IProxyFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/IProxyFactory.cs 2011-03-20 17:31:14 UTC (rev 5477) +++ trunk/nhibernate/src/NHibernate/Proxy/IProxyFactory.cs 2011-03-20 17:43:25 UTC (rev 5478) @@ -49,6 +49,6 @@ /// <exception cref="HibernateException">Indicates problems generating requested proxy.</exception> INHibernateProxy GetProxy(object id, ISessionImplementor session); - object GetFieldInterceptionProxy(); + object GetFieldInterceptionProxy(object instanceToWrap); } } Modified: trunk/nhibernate/src/NHibernate/Proxy/Map/MapProxyFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/Map/MapProxyFactory.cs 2011-03-20 17:31:14 UTC (rev 5477) +++ trunk/nhibernate/src/NHibernate/Proxy/Map/MapProxyFactory.cs 2011-03-20 17:43:25 UTC (rev 5478) @@ -24,7 +24,7 @@ return new MapProxy(new MapLazyInitializer(entityName, id, session)); } - public object GetFieldInterceptionProxy() + public object GetFieldInterceptionProxy(object getInstance) { throw new NotSupportedException(); } Modified: trunk/nhibernate/src/NHibernate/Tuple/PocoInstantiator.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Tuple/PocoInstantiator.cs 2011-03-20 17:31:14 UTC (rev 5477) +++ trunk/nhibernate/src/NHibernate/Tuple/PocoInstantiator.cs 2011-03-20 17:43:25 UTC (rev 5478) @@ -90,8 +90,13 @@ } if (generateFieldInterceptionProxy) { - return proxyFactory.GetFieldInterceptionProxy(); + return proxyFactory.GetFieldInterceptionProxy(GetInstance()); } + return GetInstance(); + } + + private object GetInstance() + { if (optimizer != null) { return optimizer.CreateInstance(); Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle/ProxyFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle/ProxyFactory.cs 2011-03-20 17:31:14 UTC (rev 5477) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle/ProxyFactory.cs 2011-03-20 17:43:25 UTC (rev 5478) @@ -44,7 +44,7 @@ } - public override object GetFieldInterceptionProxy() + public override object GetFieldInterceptionProxy(object instanceToWrap) { var proxyGenerationOptions = new ProxyGenerationOptions(); var interceptor = new LazyFieldInterceptor(); Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle.Tests/LazyFieldInterceptorSerializable.cs =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle.Tests/LazyFieldInterceptorSerializable.cs 2011-03-20 17:31:14 UTC (rev 5477) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle.Tests/LazyFieldInterceptorSerializable.cs 2011-03-20 17:43:25 UTC (rev 5478) @@ -26,7 +26,7 @@ var pf = new ProxyFactory(); var propertyInfo = typeof(MyClass).GetProperty("Id"); pf.PostInstantiate("MyClass", typeof(MyClass), new HashedSet<System.Type>(), propertyInfo.GetGetMethod(), propertyInfo.GetSetMethod(), null); - var fieldInterceptionProxy = (IFieldInterceptorAccessor)pf.GetFieldInterceptionProxy(); + var fieldInterceptionProxy = (IFieldInterceptorAccessor)pf.GetFieldInterceptionProxy(new MyClass()); fieldInterceptionProxy.FieldInterceptor = new DefaultFieldInterceptor(null, null, null, "MyClass", typeof(MyClass)); fieldInterceptionProxy.Should().Be.BinarySerializable(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-20 17:31:20
|
Revision: 5477 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5477&view=rev Author: fabiomaulo Date: 2011-03-20 17:31:14 +0000 (Sun, 20 Mar 2011) Log Message: ----------- Artifacts for default bytecode provider Modified Paths: -------------- trunk/nhibernate/src/NHibernate/NHibernate.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/Bytecode/DefaultProxyFactoryFactory.cs trunk/nhibernate/src/NHibernate/Intercept/DefaultDynamicLazyFieldInterceptor.cs trunk/nhibernate/src/NHibernate/Proxy/DefaultLazyInitializer.cs trunk/nhibernate/src/NHibernate/Proxy/DefaultProxyFactory.cs Added: trunk/nhibernate/src/NHibernate/Bytecode/DefaultProxyFactoryFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Bytecode/DefaultProxyFactoryFactory.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Bytecode/DefaultProxyFactoryFactory.cs 2011-03-20 17:31:14 UTC (rev 5477) @@ -0,0 +1,31 @@ +using NHibernate.Proxy; + +namespace NHibernate.Bytecode +{ + public class DefaultProxyFactoryFactory : IProxyFactoryFactory + { + #region IProxyFactoryFactory Members + + public IProxyFactory BuildProxyFactory() + { + return new DefaultProxyFactory(); + } + + public IProxyValidator ProxyValidator + { + get { return new DynProxyTypeValidator(); } + } + + public bool IsInstrumented(System.Type entityClass) + { + return true; + } + + public bool IsProxy(object entity) + { + return entity is INHibernateProxy; + } + + #endregion + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Intercept/DefaultDynamicLazyFieldInterceptor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Intercept/DefaultDynamicLazyFieldInterceptor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Intercept/DefaultDynamicLazyFieldInterceptor.cs 2011-03-20 17:31:14 UTC (rev 5477) @@ -0,0 +1,64 @@ +using System; +using NHibernate.Proxy.DynamicProxy; +using NHibernate.Util; + +namespace NHibernate.Intercept +{ + public class DefaultDynamicLazyFieldInterceptor : IFieldInterceptorAccessor, Proxy.DynamicProxy.IInterceptor + { + public DefaultDynamicLazyFieldInterceptor(object targetInstance) + { + if (targetInstance == null) + { + throw new ArgumentNullException("targetInstance"); + } + TargetInstance = targetInstance; + } + + public IFieldInterceptor FieldInterceptor { get; set; } + public object TargetInstance { get; private set; } + + public object Intercept(InvocationInfo info) + { + var methodName = info.TargetMethod.Name; + if (FieldInterceptor != null) + { + if (ReflectHelper.IsPropertyGet(info.TargetMethod)) + { + if("get_FieldInterceptor".Equals(methodName)) + { + return FieldInterceptor; + } + object propValue = info.TargetMethod.Invoke(TargetInstance, info.Arguments); + + var result = FieldInterceptor.Intercept(info.Target, ReflectHelper.GetPropertyName(info.TargetMethod), propValue); + + if (result != AbstractFieldInterceptor.InvokeImplementation) + { + return result; + } + } + else if (ReflectHelper.IsPropertySet(info.TargetMethod)) + { + if ("set_FieldInterceptor".Equals(methodName)) + { + FieldInterceptor = (IFieldInterceptor)info.Arguments[0]; + return null; + } + FieldInterceptor.MarkDirty(); + FieldInterceptor.Intercept(info.Target, ReflectHelper.GetPropertyName(info.TargetMethod), info.Arguments[0]); + } + } + else + { + if ("set_FieldInterceptor".Equals(methodName)) + { + FieldInterceptor = (IFieldInterceptor)info.Arguments[0]; + return null; + } + } + + return info.TargetMethod.Invoke(TargetInstance, info.Arguments); + } + } +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-03-20 17:03:52 UTC (rev 5476) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-03-20 17:31:14 UTC (rev 5477) @@ -91,6 +91,7 @@ <Compile Include="ADOException.cs" /> <Compile Include="AssemblyInfo.cs" /> <Compile Include="AssertionFailure.cs" /> + <Compile Include="Bytecode\DefaultProxyFactoryFactory.cs" /> <Compile Include="Cache\Access\ISoftLock.cs" /> <Compile Include="Cache\CachedItem.cs" /> <Compile Include="Cache\CacheException.cs" /> @@ -252,6 +253,7 @@ <Compile Include="Impl\SqlQueryImpl.cs" /> <Compile Include="Engine\Status.cs" /> <Compile Include="InstantiationException.cs" /> + <Compile Include="Intercept\DefaultDynamicLazyFieldInterceptor.cs" /> <Compile Include="IQuery.cs" /> <Compile Include="ISession.cs" /> <Compile Include="ISessionFactory.cs" /> @@ -326,6 +328,8 @@ <Compile Include="Properties\PascalCaseMUnderscoreStrategy.cs" /> <Compile Include="Properties\PascalCaseUnderscoreStrategy.cs" /> <Compile Include="Properties\PropertyAccessorFactory.cs" /> + <Compile Include="Proxy\DefaultLazyInitializer.cs" /> + <Compile Include="Proxy\DefaultProxyFactory.cs" /> <Compile Include="Proxy\DynamicProxy\DefaultArgumentHandler.cs" /> <Compile Include="Proxy\DynamicProxy\DefaultMethodEmitter.cs" /> <Compile Include="Proxy\DynamicProxy\DefaultProxyMethodBuilder.cs" /> Added: trunk/nhibernate/src/NHibernate/Proxy/DefaultLazyInitializer.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DefaultLazyInitializer.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DefaultLazyInitializer.cs 2011-03-20 17:31:14 UTC (rev 5477) @@ -0,0 +1,48 @@ +using System; +using System.Reflection; +using NHibernate.Engine; +using NHibernate.Proxy.DynamicProxy; +using NHibernate.Proxy.Poco; +using NHibernate.Type; + +namespace NHibernate.Proxy +{ + public class DefaultLazyInitializer : BasicLazyInitializer, DynamicProxy.IInterceptor + { + private static readonly MethodInfo exceptionInternalPreserveStackTrace = + typeof (Exception).GetMethod("InternalPreserveStackTrace", BindingFlags.Instance | BindingFlags.NonPublic); + + public DefaultLazyInitializer(string entityName, System.Type persistentClass, object id, MethodInfo getIdentifierMethod, + MethodInfo setIdentifierMethod, IAbstractComponentType componentIdType, + ISessionImplementor session) + : base(entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session) {} + + #region Implementation of IInterceptor + + public object Intercept(InvocationInfo info) + { + object returnValue; + try + { + returnValue = base.Invoke(info.TargetMethod, info.Arguments, info.Target); + + // Avoid invoking the actual implementation, if possible + if (returnValue != InvokeImplementation) + { + return returnValue; + } + + returnValue = info.TargetMethod.Invoke(GetImplementation(), info.Arguments); + } + catch (TargetInvocationException ex) + { + exceptionInternalPreserveStackTrace.Invoke(ex.InnerException, new Object[] {}); + throw ex.InnerException; + } + + return returnValue; + } + + #endregion + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DefaultProxyFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DefaultProxyFactory.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DefaultProxyFactory.cs 2011-03-20 17:31:14 UTC (rev 5477) @@ -0,0 +1,40 @@ +using System; +using NHibernate.Engine; +using NHibernate.Intercept; +using NHibernate.Proxy.DynamicProxy; + +namespace NHibernate.Proxy +{ + public class DefaultProxyFactory : AbstractProxyFactory + { + private static readonly ProxyFactory factory = new ProxyFactory(); + protected static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof (DefaultProxyFactory)); + + public override INHibernateProxy GetProxy(object id, ISessionImplementor session) + { + try + { + var initializer = new DefaultLazyInitializer(EntityName, PersistentClass, id, GetIdentifierMethod, SetIdentifierMethod, + ComponentIdType, session); + + object proxyInstance = IsClassProxy + ? factory.CreateProxy(PersistentClass, initializer, Interfaces) + : factory.CreateProxy(Interfaces[0], initializer, Interfaces); + + return (INHibernateProxy) proxyInstance; + } + catch (Exception ex) + { + log.Error("Creating a proxy instance failed", ex); + throw new HibernateException("Creating a proxy instance failed", ex); + } + } + + public override object GetFieldInterceptionProxy() + { + object targetInstance = Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(PersistentClass, true); + var interceptor = new DefaultDynamicLazyFieldInterceptor(targetInstance); + return factory.CreateProxy(PersistentClass, interceptor, new[] { typeof(IFieldInterceptorAccessor) }); + } + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-20 17:04:02
|
Revision: 5476 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5476&view=rev Author: fabiomaulo Date: 2011-03-20 17:03:52 +0000 (Sun, 20 Mar 2011) Log Message: ----------- "Initial" upload of embedded DynamicProxy after a little "hands on" Modified Paths: -------------- trunk/nhibernate/src/NHibernate/NHibernate.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultArgumentHandler.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultMethodEmitter.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultProxyMethodBuilder.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/HashSetExtensions.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IArgumentHandler.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IInterceptor.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IMethodBodyEmitter.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxy.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxyCache.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxyMethodBuilder.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InterceptorHandler.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InvocationHandler.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InvocationInfo.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyCache.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyCacheEntry.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyDummy.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyFactory.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyImplementor.cs trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyObjectReference.cs Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-03-16 14:16:50 UTC (rev 5475) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2011-03-20 17:03:52 UTC (rev 5476) @@ -326,6 +326,25 @@ <Compile Include="Properties\PascalCaseMUnderscoreStrategy.cs" /> <Compile Include="Properties\PascalCaseUnderscoreStrategy.cs" /> <Compile Include="Properties\PropertyAccessorFactory.cs" /> + <Compile Include="Proxy\DynamicProxy\DefaultArgumentHandler.cs" /> + <Compile Include="Proxy\DynamicProxy\DefaultMethodEmitter.cs" /> + <Compile Include="Proxy\DynamicProxy\DefaultProxyMethodBuilder.cs" /> + <Compile Include="Proxy\DynamicProxy\HashSetExtensions.cs" /> + <Compile Include="Proxy\DynamicProxy\IArgumentHandler.cs" /> + <Compile Include="Proxy\DynamicProxy\IInterceptor.cs" /> + <Compile Include="Proxy\DynamicProxy\IMethodBodyEmitter.cs" /> + <Compile Include="Proxy\DynamicProxy\InterceptorHandler.cs" /> + <Compile Include="Proxy\DynamicProxy\InvocationHandler.cs" /> + <Compile Include="Proxy\DynamicProxy\InvocationInfo.cs" /> + <Compile Include="Proxy\DynamicProxy\IProxy.cs" /> + <Compile Include="Proxy\DynamicProxy\IProxyCache.cs" /> + <Compile Include="Proxy\DynamicProxy\IProxyMethodBuilder.cs" /> + <Compile Include="Proxy\DynamicProxy\ProxyCache.cs" /> + <Compile Include="Proxy\DynamicProxy\ProxyCacheEntry.cs" /> + <Compile Include="Proxy\DynamicProxy\ProxyDummy.cs" /> + <Compile Include="Proxy\DynamicProxy\ProxyFactory.cs" /> + <Compile Include="Proxy\DynamicProxy\ProxyImplementor.cs" /> + <Compile Include="Proxy\DynamicProxy\ProxyObjectReference.cs" /> <Compile Include="Proxy\INHibernateProxy.cs" /> <Compile Include="Proxy\IProxyFactory.cs" /> <Compile Include="Proxy\AbstractLazyInitializer.cs" /> Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultArgumentHandler.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultArgumentHandler.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultArgumentHandler.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,74 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Reflection; +using System.Reflection.Emit; + +namespace NHibernate.Proxy.DynamicProxy +{ + internal class DefaultArgumentHandler : IArgumentHandler + { + #region IArgumentHandler Members + + public void PushArguments(ParameterInfo[] methodParameters, ILGenerator IL, bool isStatic) + { + ParameterInfo[] parameters = methodParameters ?? new ParameterInfo[0]; + int parameterCount = parameters.Length; + + // object[] args = new object[size]; + IL.Emit(OpCodes.Ldc_I4, parameterCount); + IL.Emit(OpCodes.Newarr, typeof (object)); + IL.Emit(OpCodes.Stloc_S, 0); + + if (parameterCount == 0) + { + IL.Emit(OpCodes.Ldloc_S, 0); + return; + } + + // Populate the object array with the list of arguments + int index = 0; + int argumentPosition = 1; + foreach (ParameterInfo param in parameters) + { + System.Type parameterType = param.ParameterType; + // args[N] = argumentN (pseudocode) + IL.Emit(OpCodes.Ldloc_S, 0); + IL.Emit(OpCodes.Ldc_I4, index); + + // Zero out the [out] parameters + if (param.IsOut) + { + IL.Emit(OpCodes.Ldnull); + IL.Emit(OpCodes.Stelem_Ref); + argumentPosition++; + index++; + continue; + } + + IL.Emit(OpCodes.Ldarg, argumentPosition); + + bool isGeneric = parameterType.IsGenericParameter; + + if (parameterType.IsValueType || isGeneric) + { + IL.Emit(OpCodes.Box, parameterType); + } + + IL.Emit(OpCodes.Stelem_Ref); + + index++; + argumentPosition++; + } + IL.Emit(OpCodes.Ldloc_S, 0); + } + + #endregion + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultMethodEmitter.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultMethodEmitter.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultMethodEmitter.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,240 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection; +using System.Reflection.Emit; + +namespace NHibernate.Proxy.DynamicProxy +{ + internal class DefaultMethodEmitter : IMethodBodyEmitter + { + private static readonly MethodInfo getInterceptor; + + private static readonly MethodInfo getGenericMethodFromHandle = typeof (MethodBase).GetMethod("GetMethodFromHandle", + BindingFlags.Public | BindingFlags.Static, null, + new[] {typeof (RuntimeMethodHandle), typeof (RuntimeTypeHandle)}, null); + + private static readonly MethodInfo getMethodFromHandle = typeof (MethodBase).GetMethod("GetMethodFromHandle", new[] {typeof (RuntimeMethodHandle)}); + private static readonly MethodInfo getTypeFromHandle = typeof(System.Type).GetMethod("GetTypeFromHandle"); + private static readonly MethodInfo handlerMethod = typeof (IInterceptor).GetMethod("Intercept"); + private static readonly ConstructorInfo infoConstructor; + private static readonly PropertyInfo interceptorProperty = typeof (IProxy).GetProperty("Interceptor"); + + private static readonly ConstructorInfo notImplementedConstructor = typeof(NotImplementedException).GetConstructor(new System.Type[0]); + + private static readonly Dictionary<string, OpCode> stindMap = new Dictionary<string, OpCode>(); + private readonly IArgumentHandler _argumentHandler; + + static DefaultMethodEmitter() + { + getInterceptor = interceptorProperty.GetGetMethod(); + var constructorTypes = new[] + { + typeof (object), typeof (MethodInfo), + typeof (StackTrace), typeof (System.Type[]), typeof (object[]) + }; + + infoConstructor = typeof (InvocationInfo).GetConstructor(constructorTypes); + + + stindMap["Bool&"] = OpCodes.Stind_I1; + stindMap["Int8&"] = OpCodes.Stind_I1; + stindMap["Uint8&"] = OpCodes.Stind_I1; + + stindMap["Int16&"] = OpCodes.Stind_I2; + stindMap["Uint16&"] = OpCodes.Stind_I2; + + stindMap["Uint32&"] = OpCodes.Stind_I4; + stindMap["Int32&"] = OpCodes.Stind_I4; + + stindMap["IntPtr"] = OpCodes.Stind_I4; + stindMap["Uint64&"] = OpCodes.Stind_I8; + stindMap["Int64&"] = OpCodes.Stind_I8; + stindMap["Float32&"] = OpCodes.Stind_R4; + stindMap["Float64&"] = OpCodes.Stind_R8; + } + + public DefaultMethodEmitter() : this(new DefaultArgumentHandler()) {} + + public DefaultMethodEmitter(IArgumentHandler argumentHandler) + { + _argumentHandler = argumentHandler; + } + + #region IMethodBodyEmitter Members + + public void EmitMethodBody(ILGenerator IL, MethodInfo method, FieldInfo field) + { + ParameterInfo[] parameters = method.GetParameters(); + IL.DeclareLocal(typeof (object[])); + IL.DeclareLocal(typeof (InvocationInfo)); + IL.DeclareLocal(typeof(System.Type[])); + + IL.Emit(OpCodes.Ldarg_0); + IL.Emit(OpCodes.Callvirt, getInterceptor); + + // if (interceptor == null) + // throw new NullReferenceException(); + + Label skipThrow = IL.DefineLabel(); + + IL.Emit(OpCodes.Dup); + IL.Emit(OpCodes.Ldnull); + IL.Emit(OpCodes.Bne_Un, skipThrow); + + IL.Emit(OpCodes.Newobj, notImplementedConstructor); + IL.Emit(OpCodes.Throw); + + IL.MarkLabel(skipThrow); + // Push the 'this' pointer onto the stack + IL.Emit(OpCodes.Ldarg_0); + + // Push the MethodInfo onto the stack + System.Type declaringType = method.DeclaringType; + + IL.Emit(OpCodes.Ldtoken, method); + if (declaringType.IsGenericType) + { + IL.Emit(OpCodes.Ldtoken, declaringType); + IL.Emit(OpCodes.Call, getGenericMethodFromHandle); + } + else + { + IL.Emit(OpCodes.Call, getMethodFromHandle); + } + + IL.Emit(OpCodes.Castclass, typeof (MethodInfo)); + + PushStackTrace(IL); + PushGenericArguments(method, IL); + _argumentHandler.PushArguments(parameters, IL, false); + + // InvocationInfo info = new InvocationInfo(...); + + IL.Emit(OpCodes.Newobj, infoConstructor); + IL.Emit(OpCodes.Stloc_1); + IL.Emit(OpCodes.Ldloc_1); + IL.Emit(OpCodes.Callvirt, handlerMethod); + + SaveRefArguments(IL, parameters); + PackageReturnType(method, IL); + + IL.Emit(OpCodes.Ret); + } + + #endregion + + private static void SaveRefArguments(ILGenerator IL, ParameterInfo[] parameters) + { + // Save the arguments returned from the handler method + MethodInfo getArguments = typeof (InvocationInfo).GetMethod("get_Arguments"); + IL.Emit(OpCodes.Ldloc_1); + IL.Emit(OpCodes.Call, getArguments); + IL.Emit(OpCodes.Stloc_0); + + foreach (ParameterInfo param in parameters) + { + string typeName = param.ParameterType.Name; + + bool isRef = param.ParameterType.IsByRef && typeName.EndsWith("&"); + if (!isRef) + { + continue; + } + + // Load the destination address + IL.Emit(OpCodes.Ldarg, param.Position + 1); + + // Load the argument value + IL.Emit(OpCodes.Ldloc_0); + IL.Emit(OpCodes.Ldc_I4, param.Position); + IL.Emit(OpCodes.Ldelem_Ref); + + typeName = typeName.Replace("&", ""); + System.Type unboxedType = System.Type.GetType(typeName); + + IL.Emit(OpCodes.Unbox_Any, unboxedType); + + OpCode stind = GetStindInstruction(param.ParameterType); + IL.Emit(stind); + } + } + + private static OpCode GetStindInstruction(System.Type parameterType) + { + if (parameterType.IsClass && !parameterType.Name.EndsWith("&")) + { + return OpCodes.Stind_Ref; + } + + + string typeName = parameterType.Name; + + if (!stindMap.ContainsKey(typeName) && parameterType.IsByRef) + { + return OpCodes.Stind_Ref; + } + + Debug.Assert(stindMap.ContainsKey(typeName)); + OpCode result = stindMap[typeName]; + + return result; + } + + private void PushStackTrace(ILGenerator IL) + { + // NOTE: The stack trace has been disabled for performance reasons + IL.Emit(OpCodes.Ldnull); + } + + private void PushGenericArguments(MethodInfo method, ILGenerator IL) + { + System.Type[] typeParameters = method.GetGenericArguments(); + + // If this is a generic method, we need to store + // the generic method arguments + int genericTypeCount = typeParameters.Length; + + // Type[] genericTypeArgs = new Type[genericTypeCount]; + IL.Emit(OpCodes.Ldc_I4, genericTypeCount); + IL.Emit(OpCodes.Newarr, typeof(System.Type)); + + if (genericTypeCount == 0) + { + return; + } + + for (int index = 0; index < genericTypeCount; index++) + { + System.Type currentType = typeParameters[index]; + + IL.Emit(OpCodes.Dup); + IL.Emit(OpCodes.Ldc_I4, index); + IL.Emit(OpCodes.Ldtoken, currentType); + IL.Emit(OpCodes.Call, getTypeFromHandle); + IL.Emit(OpCodes.Stelem_Ref); + } + } + + private void PackageReturnType(MethodInfo method, ILGenerator IL) + { + System.Type returnType = method.ReturnType; + // Unbox the return value if necessary + if (returnType == typeof (void)) + { + IL.Emit(OpCodes.Pop); + return; + } + + IL.Emit(OpCodes.Unbox_Any, returnType); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultProxyMethodBuilder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultProxyMethodBuilder.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/DefaultProxyMethodBuilder.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,67 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; + +namespace NHibernate.Proxy.DynamicProxy +{ + internal class DefaultyProxyMethodBuilder : IProxyMethodBuilder + { + public DefaultyProxyMethodBuilder() : this(new DefaultMethodEmitter()) {} + + public DefaultyProxyMethodBuilder(IMethodBodyEmitter emitter) + { + if (emitter == null) + { + throw new ArgumentNullException("emitter"); + } + MethodBodyEmitter = emitter; + } + + public IMethodBodyEmitter MethodBodyEmitter { get; private set; } + + #region IProxyMethodBuilder Members + + public void CreateProxiedMethod(FieldInfo field, MethodInfo method, TypeBuilder typeBuilder) + { + const MethodAttributes methodAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | + MethodAttributes.Virtual; + ParameterInfo[] parameters = method.GetParameters(); + + MethodBuilder methodBuilder = typeBuilder.DefineMethod(method.Name, methodAttributes, + CallingConventions.HasThis, method.ReturnType, + parameters.Select(param => param.ParameterType).ToArray()); + + System.Type[] typeArgs = method.GetGenericArguments(); + + if (typeArgs.Length > 0) + { + var typeNames = new List<string>(); + + for (int index = 0; index < typeArgs.Length; index++) + { + typeNames.Add(string.Format("T{0}", index)); + } + + methodBuilder.DefineGenericParameters(typeNames.ToArray()); + } + + ILGenerator IL = methodBuilder.GetILGenerator(); + + Debug.Assert(MethodBodyEmitter != null); + MethodBodyEmitter.EmitMethodBody(IL, method, field); + } + + #endregion + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/HashSetExtensions.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/HashSetExtensions.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/HashSetExtensions.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace NHibernate.Proxy.DynamicProxy +{ + public static class HashSetExtensions + { + public static HashSet<T> Merge<T>(this HashSet<T> source, IEnumerable<T> toMerge) + { + foreach (T item in toMerge) + { + source.Add(item); + } + return source; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IArgumentHandler.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IArgumentHandler.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IArgumentHandler.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,18 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System.Reflection; +using System.Reflection.Emit; + +namespace NHibernate.Proxy.DynamicProxy +{ + public interface IArgumentHandler + { + void PushArguments(ParameterInfo[] parameters, ILGenerator IL, bool isStatic); + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IInterceptor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IInterceptor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IInterceptor.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,15 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +namespace NHibernate.Proxy.DynamicProxy +{ + public interface IInterceptor + { + object Intercept(InvocationInfo info); + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IMethodBodyEmitter.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IMethodBodyEmitter.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IMethodBodyEmitter.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,18 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System.Reflection; +using System.Reflection.Emit; + +namespace NHibernate.Proxy.DynamicProxy +{ + public interface IMethodBodyEmitter + { + void EmitMethodBody(ILGenerator IL, MethodInfo method, FieldInfo field); + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxy.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxy.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxy.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,15 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +namespace NHibernate.Proxy.DynamicProxy +{ + public interface IProxy + { + IInterceptor Interceptor { get; set; } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxyCache.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxyCache.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxyCache.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,19 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; + +namespace NHibernate.Proxy.DynamicProxy +{ + public interface IProxyCache + { + bool Contains(System.Type baseType, params System.Type[] baseInterfaces); + System.Type GetProxyType(System.Type baseType, params System.Type[] baseInterfaces); + void StoreProxyType(System.Type result, System.Type baseType, params System.Type[] baseInterfaces); + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxyMethodBuilder.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxyMethodBuilder.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/IProxyMethodBuilder.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,18 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System.Reflection; +using System.Reflection.Emit; + +namespace NHibernate.Proxy.DynamicProxy +{ + public interface IProxyMethodBuilder + { + void CreateProxiedMethod(FieldInfo field, MethodInfo method, TypeBuilder typeBuilder); + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InterceptorHandler.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InterceptorHandler.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InterceptorHandler.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,17 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Diagnostics; +using System.Reflection; + +namespace NHibernate.Proxy.DynamicProxy +{ + public delegate object InterceptorHandler(object proxy, MethodInfo targetMethod, + StackTrace trace, System.Type[] genericTypeArgs, object[] args); +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InvocationHandler.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InvocationHandler.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InvocationHandler.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,12 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +namespace NHibernate.Proxy.DynamicProxy +{ + public delegate object InvocationHandler(InvocationInfo info); +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InvocationInfo.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InvocationInfo.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/InvocationInfo.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,109 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Diagnostics; +using System.Reflection; +using System.Text; + +namespace NHibernate.Proxy.DynamicProxy +{ + public class InvocationInfo + { + private readonly object[] args; + private readonly object proxy; + private readonly MethodInfo targetMethod; + private readonly StackTrace trace; + private readonly System.Type[] typeArgs; + + public InvocationInfo(object proxy, MethodInfo targetMethod, + StackTrace trace, System.Type[] genericTypeArgs, object[] args) + { + this.proxy = proxy; + this.targetMethod = targetMethod; + typeArgs = genericTypeArgs; + this.args = args; + this.trace = trace; + } + + public object Target + { + get { return proxy; } + } + + public MethodInfo TargetMethod + { + get { return targetMethod; } + } + + public StackTrace StackTrace + { + get { return trace; } + } + + public System.Type[] TypeArguments + { + get { return typeArgs; } + } + + public object[] Arguments + { + get { return args; } + } + + public void SetArgument(int position, object arg) + { + args[position] = arg; + } + + public override string ToString() + { + var builder = new StringBuilder(); + builder.AppendFormat("Target Method:{0,30:G}\n", GetMethodName(targetMethod)); + builder.AppendLine("Arguments:"); + + foreach (ParameterInfo info in targetMethod.GetParameters()) + { + object currentArgument = args[info.Position]; + if (currentArgument == null) + { + currentArgument = "(null)"; + } + builder.AppendFormat("\t{0,10:G}: {1}\n", info.Name, currentArgument); + } + builder.AppendLine(); + + return builder.ToString(); + } + + private string GetMethodName(MethodInfo method) + { + var builder = new StringBuilder(512); + builder.AppendFormat("{0}.{1}", method.DeclaringType.Name, method.Name); + builder.Append("("); + + ParameterInfo[] parameters = method.GetParameters(); + int parameterCount = parameters.Length; + + int index = 0; + foreach (ParameterInfo param in parameters) + { + index++; + builder.AppendFormat("{0} {1}", param.ParameterType.Name, param.Name); + + if (index < parameterCount) + { + builder.Append(", "); + } + } + builder.Append(")"); + + return builder.ToString(); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyCache.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyCache.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyCache.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,52 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Collections.Generic; + +namespace NHibernate.Proxy.DynamicProxy +{ + public class ProxyCache : IProxyCache + { + private readonly Dictionary<ProxyCacheEntry, System.Type> cache = new Dictionary<ProxyCacheEntry, System.Type>(); + private readonly object syncObject = new object(); + + #region IProxyCache Members + + public bool Contains(System.Type baseType, params System.Type[] baseInterfaces) + { + if (baseType == null) + { + return false; + } + + var entry = new ProxyCacheEntry(baseType, baseInterfaces); + return cache.ContainsKey(entry); + } + + public System.Type GetProxyType(System.Type baseType, params System.Type[] baseInterfaces) + { + lock (syncObject) + { + var entry = new ProxyCacheEntry(baseType, baseInterfaces); + return cache[entry]; + } + } + + public void StoreProxyType(System.Type result, System.Type baseType, params System.Type[] baseInterfaces) + { + lock (syncObject) + { + var entry = new ProxyCacheEntry(baseType, baseInterfaces); + cache[entry] = result; + } + } + + #endregion + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyCacheEntry.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyCacheEntry.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyCacheEntry.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,62 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Collections.Generic; + +namespace NHibernate.Proxy.DynamicProxy +{ + [Serializable] + public class ProxyCacheEntry + { + private readonly int hashCode; + + public ProxyCacheEntry(System.Type baseType, System.Type[] interfaces) + { + if (baseType == null) + { + throw new ArgumentNullException("baseType"); + } + BaseType = baseType; + Interfaces = interfaces ?? new System.Type[0]; + + if (Interfaces.Length == 0) + { + hashCode = baseType.GetHashCode(); + return; + } + + // duplicated type exclusion + var set = new HashSet<System.Type>(Interfaces) { baseType }; + hashCode = 59; + foreach (System.Type type in set) + { + hashCode ^= type.GetHashCode(); + } + } + + public System.Type BaseType { get; private set; } + public System.Type[] Interfaces { get; private set; } + + public override bool Equals(object obj) + { + var that = obj as ProxyCacheEntry; + if (ReferenceEquals(null, that)) + { + return false; + } + + return hashCode == that.GetHashCode(); + } + + public override int GetHashCode() + { + return hashCode; + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyDummy.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyDummy.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyDummy.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,15 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +namespace NHibernate.Proxy.DynamicProxy +{ + public class ProxyDummy + { + /* No Implementation */ + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyFactory.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyFactory.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyFactory.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,306 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.Serialization; + +namespace NHibernate.Proxy.DynamicProxy +{ + public sealed class ProxyFactory + { + private static readonly ConstructorInfo baseConstructor = typeof(object).GetConstructor(new System.Type[0]); + private static readonly MethodInfo getTypeFromHandle = typeof(System.Type).GetMethod("GetTypeFromHandle"); + + private static readonly MethodInfo getValue = typeof (SerializationInfo).GetMethod("GetValue", BindingFlags.Public | BindingFlags.Instance, null, + new[] { typeof(string), typeof(System.Type) }, null); + + private static readonly MethodInfo setType = typeof(SerializationInfo).GetMethod("SetType", BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(System.Type) }, null); + + private static readonly MethodInfo addValue = typeof (SerializationInfo).GetMethod("AddValue", BindingFlags.Public | BindingFlags.Instance, null, + new[] {typeof (string), typeof (object)}, null); + + public ProxyFactory() + : this(new DefaultyProxyMethodBuilder()) {} + + public ProxyFactory(IProxyMethodBuilder proxyMethodBuilder) + { + if (proxyMethodBuilder == null) + { + throw new ArgumentNullException("proxyMethodBuilder"); + } + ProxyMethodBuilder = proxyMethodBuilder; + Cache = new ProxyCache(); + } + + public IProxyCache Cache { get; private set; } + + public IProxyMethodBuilder ProxyMethodBuilder { get; private set; } + + public object CreateProxy(System.Type instanceType, IInterceptor interceptor, params System.Type[] baseInterfaces) + { + System.Type proxyType = CreateProxyType(instanceType, baseInterfaces); + object result = Activator.CreateInstance(proxyType); + var proxy = (IProxy) result; + proxy.Interceptor = interceptor; + + return result; + } + + public System.Type CreateProxyType(System.Type baseType, params System.Type[] interfaces) + { + System.Type[] baseInterfaces = ReferenceEquals(null, interfaces) ? new System.Type[0] : interfaces.Where(t => t != null).ToArray(); + // Reuse the previous results, if possible + if (Cache.Contains(baseType, baseInterfaces)) + { + return Cache.GetProxyType(baseType, baseInterfaces); + } + + System.Type result = CreateUncachedProxyType(baseType, baseInterfaces); + + // Cache the proxy type + if (result != null && Cache != null) + { + Cache.StoreProxyType(result, baseType, baseInterfaces); + } + + return result; + } + + private System.Type CreateUncachedProxyType(System.Type baseType, System.Type[] baseInterfaces) + { + AppDomain currentDomain = AppDomain.CurrentDomain; + string typeName = string.Format("{0}Proxy", baseType.Name); + string assemblyName = string.Format("{0}Assembly", typeName); + string moduleName = string.Format("{0}Module", typeName); + + var name = new AssemblyName(assemblyName); +#if DEBUG + AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave; +#else + AssemblyBuilderAccess access = AssemblyBuilderAccess.Run; +#endif + AssemblyBuilder assemblyBuilder = currentDomain.DefineDynamicAssembly(name, access); + +#if DEBUG + ModuleBuilder moduleBuilder = + assemblyBuilder.DefineDynamicModule(moduleName, string.Format("{0}.mod", moduleName), true); +#else + ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(moduleName); +#endif + + TypeAttributes typeAttributes = TypeAttributes.AutoClass | TypeAttributes.Class | + TypeAttributes.Public | TypeAttributes.BeforeFieldInit; + + var interfaces = new HashSet<System.Type>(); + interfaces.Merge(baseInterfaces); + + // Use the proxy dummy as the base type + // since we're not inheriting from any class type + System.Type parentType = baseType; + if (baseType.IsInterface) + { + parentType = typeof (ProxyDummy); + interfaces.Add(baseType); + } + + // Add any inherited interfaces + System.Type[] computedInterfaces = interfaces.ToArray(); + foreach (System.Type interfaceType in computedInterfaces) + { + interfaces.Merge(GetInterfaces(interfaceType)); + } + + // Add the ISerializable interface so that it can be implemented + interfaces.Add(typeof (ISerializable)); + + TypeBuilder typeBuilder = moduleBuilder.DefineType(typeName, typeAttributes, parentType, interfaces.ToArray()); + + ConstructorBuilder defaultConstructor = DefineConstructor(typeBuilder); + + // Implement IProxy + var implementor = new ProxyImplementor(); + implementor.ImplementProxy(typeBuilder); + + FieldInfo interceptorField = implementor.InterceptorField; + + // Provide a custom implementation of ISerializable + // instead of redirecting it back to the interceptor + foreach (MethodInfo method in GetProxiableMethods(baseType, interfaces).Where(method => method.DeclaringType != typeof(ISerializable))) + { + ProxyMethodBuilder.CreateProxiedMethod(interceptorField, method, typeBuilder); + } + + // Make the proxy serializable + AddSerializationSupport(baseType, baseInterfaces, typeBuilder, interceptorField, defaultConstructor); + System.Type proxyType = typeBuilder.CreateType(); + +#if DEBUG_PROXY_OUTPUT + assemblyBuilder.Save("generatedAssembly.dll"); +#endif + return proxyType; + } + + private IEnumerable<System.Type> GetInterfaces(System.Type currentType) + { + return GetAllInterfaces(currentType); + } + + private IEnumerable<System.Type> GetAllInterfaces(System.Type currentType) + { + System.Type[] interfaces = currentType.GetInterfaces(); + + foreach (System.Type current in interfaces) + { + yield return current; + foreach (System.Type @interface in GetAllInterfaces(current)) + { + yield return @interface; + } + } + } + + private IEnumerable<MethodInfo> GetProxiableMethods(System.Type type, IEnumerable<System.Type> interfaces) + { + const BindingFlags candidateMethodsBindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; + return + type.GetMethods(candidateMethodsBindingFlags) + .Where(method => IsProxiable(method)) + .Concat(interfaces.SelectMany(interfaceType => interfaceType.GetMethods())).Distinct(); + } + + private bool IsProxiable(MethodInfo method) + { + return (((method.IsPublic || method.IsFamily || method.IsAssembly || method.IsFamilyOrAssembly) + && (method.IsVirtual || method.IsAbstract)) + && (method.DeclaringType != typeof(MarshalByRefObject))) + && (method.DeclaringType != typeof(object) || !"finalize".Equals(method.Name.ToLowerInvariant())); + } + + private static ConstructorBuilder DefineConstructor(TypeBuilder typeBuilder) + { + const MethodAttributes constructorAttributes = MethodAttributes.Public | + MethodAttributes.HideBySig | MethodAttributes.SpecialName | + MethodAttributes.RTSpecialName; + + ConstructorBuilder constructor = + typeBuilder.DefineConstructor(constructorAttributes, CallingConventions.Standard, new System.Type[0]); + + ILGenerator IL = constructor.GetILGenerator(); + + constructor.SetImplementationFlags(MethodImplAttributes.IL | MethodImplAttributes.Managed); + + IL.Emit(OpCodes.Ldarg_0); + IL.Emit(OpCodes.Call, baseConstructor); + IL.Emit(OpCodes.Ret); + + return constructor; + } + + private static void ImplementGetObjectData(System.Type baseType, System.Type[] baseInterfaces, TypeBuilder typeBuilder, FieldInfo interceptorField) + { + const MethodAttributes attributes = MethodAttributes.Public | MethodAttributes.HideBySig | + MethodAttributes.Virtual; + var parameterTypes = new[] {typeof (SerializationInfo), typeof (StreamingContext)}; + + MethodBuilder methodBuilder = + typeBuilder.DefineMethod("GetObjectData", attributes, typeof (void), parameterTypes); + + ILGenerator IL = methodBuilder.GetILGenerator(); + //LocalBuilder proxyBaseType = IL.DeclareLocal(typeof(Type)); + + // info.SetType(typeof(ProxyObjectReference)); + IL.Emit(OpCodes.Ldarg_1); + IL.Emit(OpCodes.Ldtoken, typeof (ProxyObjectReference)); + IL.Emit(OpCodes.Call, getTypeFromHandle); + IL.Emit(OpCodes.Callvirt, setType); + + // info.AddValue("__interceptor", __interceptor); + IL.Emit(OpCodes.Ldarg_1); + IL.Emit(OpCodes.Ldstr, "__interceptor"); + IL.Emit(OpCodes.Ldarg_0); + IL.Emit(OpCodes.Ldfld, interceptorField); + IL.Emit(OpCodes.Callvirt, addValue); + + IL.Emit(OpCodes.Ldarg_1); + IL.Emit(OpCodes.Ldstr, "__baseType"); + IL.Emit(OpCodes.Ldstr, baseType.AssemblyQualifiedName); + IL.Emit(OpCodes.Callvirt, addValue); + + int baseInterfaceCount = baseInterfaces.Length; + + // Save the number of base interfaces + IL.Emit(OpCodes.Ldarg_1); + IL.Emit(OpCodes.Ldstr, "__baseInterfaceCount"); + IL.Emit(OpCodes.Ldc_I4, baseInterfaceCount); + IL.Emit(OpCodes.Box, typeof (Int32)); + IL.Emit(OpCodes.Callvirt, addValue); + + int index = 0; + foreach (System.Type baseInterface in baseInterfaces) + { + IL.Emit(OpCodes.Ldarg_1); + IL.Emit(OpCodes.Ldstr, string.Format("__baseInterface{0}", index++)); + IL.Emit(OpCodes.Ldstr, baseInterface.AssemblyQualifiedName); + IL.Emit(OpCodes.Callvirt, addValue); + } + + IL.Emit(OpCodes.Ret); + } + + private static void DefineSerializationConstructor(TypeBuilder typeBuilder, FieldInfo interceptorField, ConstructorBuilder defaultConstructor) + { + const MethodAttributes constructorAttributes = MethodAttributes.Public | + MethodAttributes.HideBySig | MethodAttributes.SpecialName | + MethodAttributes.RTSpecialName; + + var parameterTypes = new[] {typeof (SerializationInfo), typeof (StreamingContext)}; + ConstructorBuilder constructor = typeBuilder.DefineConstructor(constructorAttributes, + CallingConventions.Standard, parameterTypes); + + ILGenerator IL = constructor.GetILGenerator(); + + LocalBuilder interceptorType = IL.DeclareLocal(typeof(System.Type)); + //LocalBuilder interceptor = IL.DeclareLocal(typeof(IInterceptor)); + + constructor.SetImplementationFlags(MethodImplAttributes.IL | MethodImplAttributes.Managed); + + + IL.Emit(OpCodes.Ldtoken, typeof (IInterceptor)); + IL.Emit(OpCodes.Call, getTypeFromHandle); + IL.Emit(OpCodes.Stloc, interceptorType); + + IL.Emit(OpCodes.Ldarg_0); + IL.Emit(OpCodes.Call, defaultConstructor); + + // __interceptor = (IInterceptor)info.GetValue("__interceptor", typeof(IInterceptor)); + IL.Emit(OpCodes.Ldarg_0); + IL.Emit(OpCodes.Ldarg_1); + IL.Emit(OpCodes.Ldstr, "__interceptor"); + IL.Emit(OpCodes.Ldloc, interceptorType); + IL.Emit(OpCodes.Callvirt, getValue); + IL.Emit(OpCodes.Castclass, typeof (IInterceptor)); + IL.Emit(OpCodes.Stfld, interceptorField); + + IL.Emit(OpCodes.Ret); + } + + private static void AddSerializationSupport(System.Type baseType, System.Type[] baseInterfaces, TypeBuilder typeBuilder, FieldInfo interceptorField, ConstructorBuilder defaultConstructor) + { + ConstructorInfo serializableConstructor = typeof(SerializableAttribute).GetConstructor(new System.Type[0]); + var customAttributeBuilder = new CustomAttributeBuilder(serializableConstructor, new object[0]); + typeBuilder.SetCustomAttribute(customAttributeBuilder); + + DefineSerializationConstructor(typeBuilder, interceptorField, defaultConstructor); + ImplementGetObjectData(baseType, baseInterfaces, typeBuilder, interceptorField); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyImplementor.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyImplementor.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyImplementor.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,64 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Reflection; +using System.Reflection.Emit; + +namespace NHibernate.Proxy.DynamicProxy +{ + internal class ProxyImplementor + { + private const MethodAttributes InterceptorMethodsAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | + MethodAttributes.SpecialName | MethodAttributes.NewSlot | + MethodAttributes.Virtual; + + private FieldBuilder field; + + public FieldBuilder InterceptorField + { + get { return field; } + } + + public void ImplementProxy(TypeBuilder typeBuilder) + { + // Implement the IProxy interface + typeBuilder.AddInterfaceImplementation(typeof (IProxy)); + + field = typeBuilder.DefineField("__interceptor", typeof (IInterceptor), FieldAttributes.Private); + + // Implement the getter + MethodBuilder getterMethod = typeBuilder.DefineMethod("get_Interceptor", InterceptorMethodsAttributes, CallingConventions.HasThis, typeof(IInterceptor), new System.Type[0]); + getterMethod.SetImplementationFlags(MethodImplAttributes.Managed | MethodImplAttributes.IL); + + ILGenerator IL = getterMethod.GetILGenerator(); + + // This is equivalent to: + // get { return __interceptor; + IL.Emit(OpCodes.Ldarg_0); + IL.Emit(OpCodes.Ldfld, field); + IL.Emit(OpCodes.Ret); + + // Implement the setter + MethodBuilder setterMethod = typeBuilder.DefineMethod("set_Interceptor", InterceptorMethodsAttributes, CallingConventions.HasThis, typeof (void), new[] {typeof (IInterceptor)}); + + setterMethod.SetImplementationFlags(MethodImplAttributes.Managed | MethodImplAttributes.IL); + IL = setterMethod.GetILGenerator(); + IL.Emit(OpCodes.Ldarg_0); + IL.Emit(OpCodes.Ldarg_1); + IL.Emit(OpCodes.Stfld, field); + IL.Emit(OpCodes.Ret); + + MethodInfo originalSetter = typeof (IProxy).GetMethod("set_Interceptor"); + MethodInfo originalGetter = typeof (IProxy).GetMethod("get_Interceptor"); + + typeBuilder.DefineMethodOverride(setterMethod, originalSetter); + typeBuilder.DefineMethodOverride(getterMethod, originalGetter); + } + } +} \ No newline at end of file Added: trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyObjectReference.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyObjectReference.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/Proxy/DynamicProxy/ProxyObjectReference.cs 2011-03-20 17:03:52 UTC (rev 5476) @@ -0,0 +1,63 @@ +#region Credits + +// This work is based on LinFu.DynamicProxy framework (c) Philip Laureano who has donated it to NHibernate project. +// The license is the same of NHibernate license (LGPL Version 2.1, February 1999). +// The source was then modified to be the default DynamicProxy of NHibernate project. + +#endregion + +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace NHibernate.Proxy.DynamicProxy +{ + [Serializable] + public class ProxyObjectReference : IObjectReference, ISerializable + { + private readonly System.Type _baseType; + private readonly IProxy _proxy; + + protected ProxyObjectReference(SerializationInfo info, StreamingContext context) + { + // Deserialize the base type using its assembly qualified name + string qualifiedName = info.GetString("__baseType"); + _baseType = System.Type.GetType(qualifiedName, true, false); + + // Rebuild the list of interfaces + var interfaceList = new List<System.Type>(); + int interfaceCount = info.GetInt32("__baseInterfaceCount"); + for (int i = 0; i < interfaceCount; i++) + { + string keyName = string.Format("__baseInterface{0}", i); + string currentQualifiedName = info.GetString(keyName); + System.Type interfaceType = System.Type.GetType(currentQualifiedName, true, false); + + interfaceList.Add(interfaceType); + } + + // Reconstruct the proxy + var factory = new ProxyFactory(); + System.Type proxyType = factory.CreateProxyType(_baseType, interfaceList.ToArray()); + + // Initialize the proxy with the deserialized data + var args = new object[] {info, context}; + _proxy = (IProxy) Activator.CreateInstance(proxyType, args); + } + + #region IObjectReference Members + + public object GetRealObject(StreamingContext context) + { + return _proxy; + } + + #endregion + + #region ISerializable Members + + public void GetObjectData(SerializationInfo info, StreamingContext context) {} + + #endregion + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jul...@us...> - 2011-03-16 14:16:56
|
Revision: 5475 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5475&view=rev Author: julian-maughan Date: 2011-03-16 14:16:50 +0000 (Wed, 16 Mar 2011) Log Message: ----------- Documentation correction (ref. NH-2575) Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/basic_mapping.xml Modified: trunk/nhibernate/doc/reference/modules/basic_mapping.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2011-03-16 04:24:20 UTC (rev 5474) +++ trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2011-03-16 14:16:50 UTC (rev 5475) @@ -319,7 +319,7 @@ </callout> </calloutlist> </programlistingco> - + <para> It is perfectly acceptable for the named persistent class to be an interface. You would then declare implementing classes of that interface using the <literal><subclass></literal> @@ -327,10 +327,10 @@ class name using the standard form ie. <literal>Eg.Foo+Bar, Eg</literal>. Due to an HQL parser limitation inner classes can not be used in queries in NHibernate 1.0. </para> - + <para> - Immutable classes, <literal>mutable="false"</literal>, may not be updated or deleted by the - application. This allows NHibernate to make some minor performance optimizations. + Changes to immutable classes, <literal>mutable="false"</literal>, will not be + persisted. This allows NHibernate to make some minor performance optimizations. </para> <para> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-16 04:24:26
|
Revision: 5474 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5474&view=rev Author: patearl Date: 2011-03-16 04:24:20 +0000 (Wed, 16 Mar 2011) Log Message: ----------- Tests: Avoid full join test with SQLite since it doesn't look like it can be emulated within the existing dialect structure for join formulation. This may be worth revisiting. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/FullJoinTest.cs trunk/nhibernate/src/NHibernate.Test/TestDialect.cs trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/FullJoinTest.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/FullJoinTest.cs 2011-03-14 20:21:30 UTC (rev 5473) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1857/FullJoinTest.cs 2011-03-16 04:24:20 UTC (rev 5474) @@ -42,6 +42,11 @@ } } + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.GetTestDialect(dialect).SupportsFullJoin; + } + [Test] public void TestFullJoin() { Modified: trunk/nhibernate/src/NHibernate.Test/TestDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/TestDialect.cs 2011-03-14 20:21:30 UTC (rev 5473) +++ trunk/nhibernate/src/NHibernate.Test/TestDialect.cs 2011-03-16 04:24:20 UTC (rev 5474) @@ -33,5 +33,7 @@ /// will cause a "database is locked" error message. /// </summary> public virtual bool SupportsConcurrentTransactions { get { return true; } } + + public virtual bool SupportsFullJoin { get { return true; } } } } Modified: trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs 2011-03-14 20:21:30 UTC (rev 5473) +++ trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs 2011-03-16 04:24:20 UTC (rev 5474) @@ -31,5 +31,10 @@ { get { return false; } } + + public override bool SupportsFullJoin + { + get { return false; } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-14 20:21:37
|
Revision: 5473 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5473&view=rev Author: fabiomaulo Date: 2011-03-14 20:21:30 +0000 (Mon, 14 Mar 2011) Log Message: ----------- Refactoring nuget scripts Modified Paths: -------------- trunk/nhibernate/build-common/common.xml trunk/nhibernate/default.build trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.build trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.nuspec.template trunk/nhibernate/src/NHibernate/NHibernate.build trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template trunk/nhibernate/src/NHibernate.ByteCode.Spring/ByteCode.build trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.Spring.nuspec.template Modified: trunk/nhibernate/build-common/common.xml =================================================================== --- trunk/nhibernate/build-common/common.xml 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/build-common/common.xml 2011-03-14 20:21:30 UTC (rev 5473) @@ -255,4 +255,15 @@ <target name="common.find-ndoc"> <property name="ndoc-console" value="${tools.dir}/ndoc/NDocConsole.exe" /> </target> + + <target name="nuget.set-properties"> + <property name="nuget.nupackages.relative-dir" value="nuget_gallery" /> + <!-- The nuget.workingdir is the directory from where all *.nuspec files will work. + This is to simplify the compilation of *.nuspec.template files (see section 'files')--> + <property name="nuget.workingdir" value="${build.dir}/tmp_nugetdeploy" /> + + <property name="nuget.nupackages.dir" value="${build.dir}/${nuget.nupackages.relative-dir}" /> + <property name="nuget.nupackages.pushbatfile" value="${nuget.nupackages.dir}/NuGetPush.bat" /> + </target> + </project> Modified: trunk/nhibernate/default.build =================================================================== --- trunk/nhibernate/default.build 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/default.build 2011-03-14 20:21:30 UTC (rev 5473) @@ -386,48 +386,62 @@ <include name="NHibernate.ByteCode.Spring/ByteCode.build" /> </fileset> - <target name="nuspec" depends="init" description="Create nuspec files"> + <target name="nuspec" depends="init nuget.set-properties" description="Create nuspec files"> <nant target="nuspec"> <buildfiles refid="nugetfiles.all" /> </nant> </target> - <target name="nuget" depends="init binaries nuspec" + <target name="nuget" depends="init binaries nuget.set-properties nuspec" description="Creates files for the release on nuget gallery."> - - <property name="nuget.conf-template" value="${build.dir}/NHibernateXmlConfigurationTemplates" /> - <copy file="releasenotes.txt" tofile="${build.dir}/NHibernate.releasenotes.txt"/> - <copy file="readme.html" tofile="${build.dir}/NHibernate.readme.html"/> - <copy file="lgpl.txt" tofile="${build.dir}/NHibernate.license.txt"/> - <!--Configuration templates--> - <copy todir="${nuget.conf-template}"> - <fileset basedir="src/NHibernate.Config.Templates"> - <include name="*"/> - </fileset> - </copy> - - <property name="nugetdeploy.subdir" value="nuget_gallery" /> - <mkdir dir="${build.dir}/${nugetdeploy.subdir}" /> - + <nant target="nuget"> <buildfiles refid="nugetfiles.all" /> </nant> - <!--Create NuGet push bat --> - <copy file="${tools.dir}/NuGet.exe" todir="${build.dir}/${nugetdeploy.subdir}"/> - <property name="nugetdeploy.pushbatfile" value="${build.dir}/${nugetdeploy.subdir}/NuGetPush.bat" /> + <mkdir dir="${nuget.nupackages.dir}" /> + <move todir="${nuget.nupackages.dir}"> + <fileset basedir="${nuget.workingdir}"> + <include name="*.nupkg" /> + </fileset> + </move> + </target> + + <target name="nugetpushbat" depends="init binaries nuget.set-properties nuspec nuget" + description="Creates files for the release on nuget gallery."> - <echo message="rem The parameter is your NuGet access key ${environment::newline()}" file="${nugetdeploy.pushbatfile}" append="false"/> + <copy file="${tools.dir}/NuGet.exe" todir="${nuget.nupackages.dir}"/> + + <echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/> <foreach item="File" property="filename"> <in> <items> - <include name="${build.dir}/${nugetdeploy.subdir}/*.nupkg"/> + <include name="${nuget.nupackages.dir}/*.nupkg"/> </items> </in> <do> - <echo message="nuget push -source http://packages.nuget.org/v1/ ${filename} %1 ${environment::newline()}" file="${nugetdeploy.pushbatfile}" append="true"/> + <echo message="nuget push -source http://packages.nuget.org/v1/ ${filename} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/> </do> </foreach> </target> + + <target name="nugetpush" depends="init binaries nuget.set-properties nuspec nuget" + description="Push packages on nuget gallery."> + <!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' --> + <foreach item="File" property="filename"> + <in> + <items> + <include name="${nuget.nupackages.dir}/*.nupkg"/> + </items> + </in> + <do> + <exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="NuGet.exe"> + <arg value="push" /> + <arg line="-source http://packages.nuget.org/v1/"/> + <arg value="${filename}" /> + </exec> + </do> + </foreach> + </target> </project> Modified: trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.build =================================================================== --- trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.build 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.build 2011-03-14 20:21:30 UTC (rev 5473) @@ -35,19 +35,22 @@ <target name="generate-assemblyinfo" depends="init common.generate-assemblyinfo" /> <target name="build" depends="init generate-assemblyinfo common.compile-dll" description="Build Iesi.Collections" /> - <target name="nuspec" depends="init" description="Create nuspec for Iesi.Collections"> - <property name="nuspec.destination.file" value="${build.dir}/${nuspec.destination.filename}" /> + <target name="nuspec" depends="init nuget.set-properties" description="Create nuspec for Iesi.Collections"> + <property name="nuspec.destination.file" value="${nuget.workingdir}/${nuspec.destination.filename}" /> <copy file="Iesi.Collections.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/version" value="${project.version.numeric}" /> </target> - <target name="nuget" depends="init nuspec"> - <exec basedir="${tools.dir}" workingdir="${build.dir}" program="NuGet.exe"> + <target name="nuget" depends="init nuget.set-properties nuspec"> + <!-- Prepare working dir with file needed by Iesi.Collections.nuspec --> + <copy file="${bin.dir}/Iesi.Collections.dll" todir="${nuget.workingdir}"/> + <copy file="${bin.dir}/Iesi.Collections.xml" todir="${nuget.workingdir}"/> + + <exec basedir="${tools.dir}" workingdir="${nuget.workingdir}" program="NuGet.exe"> <arg value="pack" /> <arg value="${nuspec.destination.filename}" /> - <arg line="-o ${nugetdeploy.subdir}" /> </exec> </target> Modified: trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.nuspec.template =================================================================== --- trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.nuspec.template 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.nuspec.template 2011-03-14 20:21:30 UTC (rev 5473) @@ -13,8 +13,6 @@ <tags>Collections</tags> </metadata> <files> - <file src="bin\net-3.5\Iesi.Collections.dll" target="lib\Net35" /> - <file src="bin\net-3.5\Iesi.Collections.pdb" target="lib\Net35" /> - <file src="bin\net-3.5\Iesi.Collections.license.txt" target="lib\Net35" /> + <file src="Iesi.Collections.*" target="lib\Net35" /> </files> </package> \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate/NHibernate.build =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.build 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/NHibernate/NHibernate.build 2011-03-14 20:21:30 UTC (rev 5473) @@ -77,8 +77,8 @@ <copy file="${bin.dir}/NHibernate.dll" tofile="${root.dir}/${lib.framework.dir}/NHibernate.dll"/> </target> - <target name="nuspec" depends="init" description="Create nuspec for Iesi.Collections"> - <property name="nuspec.destination.file" value="${build.dir}/${nuspec.destination.filename}" /> + <target name="nuspec" depends="init nuget.set-properties" description="Create nuspec for NHibernate"> + <property name="nuspec.destination.file" value="${nuget.workingdir}/${nuspec.destination.filename}" /> <copy file="NHibernate.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/dependencies/dependency[@id = 'Iesi.Collections']/@version" @@ -88,11 +88,27 @@ value="${project.version.numeric}" /> </target> - <target name="nuget" depends="init nuspec"> - <exec basedir="${tools.dir}" workingdir="${build.dir}" program="NuGet.exe"> + <target name="nuget" depends="init nuget.set-properties nuspec"> + <!-- Prepare working dir with file needed by NHibernate.nuspec --> + <copy file="${bin.dir}/NHibernate.dll" todir="${nuget.workingdir}"/> + <copy file="${bin.dir}/NHibernate.xml" todir="${nuget.workingdir}"/> + <copy file="${root.dir}/releasenotes.txt" tofile="${nuget.workingdir}/NHibernate.releasenotes.txt"/> + <copy file="${root.dir}/readme.html" tofile="${nuget.workingdir}/NHibernate.readme.html"/> + <copy file="${root.dir}/lgpl.txt" tofile="${nuget.workingdir}/NHibernate.license.txt"/> + <copy todir="${nuget.workingdir}"> + <fileset basedir="${root.dir}/src/NHibernate"> + <include name="*.xsd" /> + </fileset> + </copy> + <copy todir="${nuget.workingdir}/NHibernateXmlConfigurationTemplates"> + <fileset basedir="../NHibernate.Config.Templates"> + <include name="*"/> + </fileset> + </copy> + + <exec basedir="${tools.dir}" workingdir="${nuget.workingdir}" program="NuGet.exe"> <arg value="pack" /> <arg value="${nuspec.destination.filename}" /> - <arg line="-o ${nugetdeploy.subdir}" /> </exec> </target> Modified: trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-03-14 20:21:30 UTC (rev 5473) @@ -4,21 +4,24 @@ <id>NHibernate</id> <version>x.y.z</version> <authors>NHibernate community, Hibernate community</authors> - <summary>NHibernate is a mature, open source object-relational mapper for the .NET framework.</summary> + <summary>DONT INSTALL IT DIRECTLY. Use only as reference for others frameworks.</summary> <description> DONT INSTALL IT DIRECTLY Only as reference for others frameworks. + see NHibernate.Castle, NHibernate.LinFu, NHibernate.Spring. NHibernate is a mature, open source object-relational mapper for the .NET framework. It's actively developed , fully featured and used in thousands of successful projects. </description> <language>en-US</language> - <tags>ORM, DataBase, DAL, Object Relational Mapping</tags> + <tags>ORM, DataBase, DAL, ObjectRelationalMapping</tags> <dependencies> <dependency id="Iesi.Collections" version="x.y.z" /> </dependencies> </metadata> <files> - <file src="bin\net-3.5\NHibernate.dll" target="lib\Net35" /> + <file src="NHibernate.dll" target="lib\Net35" /> + <file src="NHibernate.xml" target="lib\Net35" /> + <file src="*.xsd" target="lib\Net35" /> <file src="NHibernate.releasenotes.txt" target="lib\Net35" /> <file src="NHibernate.readme.html" target="lib\Net35" /> <file src="NHibernate.license.txt" target="lib\Net35" /> Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build 2011-03-14 20:21:30 UTC (rev 5473) @@ -33,8 +33,8 @@ <target name="generate-assemblyinfo" depends="init common.generate-assemblyinfo" /> <target name="build" depends="init generate-assemblyinfo common.compile-dll" description="Build Castle ByteCode" /> - <target name="nuspec" depends="init" description="Create nuspec for NHibernate.ByteCode.Castle"> - <property name="nuspec.destination.file" value="${build.dir}/${nuspec.destination.filename}" /> + <target name="nuspec" depends="init nuget.set-properties" description="Create nuspec for NHibernate.ByteCode.Castle"> + <property name="nuspec.destination.file" value="${nuget.workingdir}/${nuspec.destination.filename}" /> <copy file="NHibernate.Castle.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/dependencies/dependency[@id = 'NHibernate']/@version" @@ -43,11 +43,14 @@ xpath="/package/metadata/version" value="${project.version.numeric}" /> </target> - <target name="nuget" depends="init nuspec"> - <exec basedir="${tools.dir}" workingdir="${build.dir}" program="NuGet.exe"> + <target name="nuget" depends="init nuget.set-properties nuspec"> + <!-- Prepare working dir with file needed by NHibernate.Castle.nuspec --> + <copy file="${bin.dir}/NHibernate.ByteCode.Castle.dll" todir="${nuget.workingdir}"/> + <copy file="${bin.dir}/NHibernate.ByteCode.Castle.xml" todir="${nuget.workingdir}"/> + + <exec basedir="${tools.dir}" workingdir="${nuget.workingdir}" program="NuGet.exe"> <arg value="pack" /> <arg value="${nuspec.destination.filename}" /> - <arg line="-o ${nugetdeploy.subdir}" /> </exec> </target> Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template 2011-03-14 20:21:30 UTC (rev 5473) @@ -17,7 +17,7 @@ </dependencies> </metadata> <files> - <file src="bin\net-3.5\NHibernate.ByteCode.Castle.dll" target="lib\Net35" /> - <file src="bin\net-3.5\NHibernate.ByteCode.Castle.xml" target="lib\Net35" /> + <file src="NHibernate.ByteCode.Castle.dll" target="lib\Net35" /> + <file src="NHibernate.ByteCode.Castle.xml" target="lib\Net35" /> </files> </package> \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build 2011-03-14 20:21:30 UTC (rev 5473) @@ -33,8 +33,8 @@ <target name="generate-assemblyinfo" depends="init common.generate-assemblyinfo" /> <target name="build" depends="init generate-assemblyinfo common.compile-dll" description="Build LinFu ByteCode" /> - <target name="nuspec" depends="init" description="Create nuspec for NHibernate.ByteCode.LinFu"> - <property name="nuspec.destination.file" value="${build.dir}/${nuspec.destination.filename}" /> + <target name="nuspec" depends="init nuget.set-properties" description="Create nuspec for NHibernate.ByteCode.LinFu"> + <property name="nuspec.destination.file" value="${nuget.workingdir}/${nuspec.destination.filename}" /> <copy file="NHibernate.LinFu.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/dependencies/dependency[@id = 'NHibernate']/@version" @@ -43,11 +43,19 @@ xpath="/package/metadata/version" value="${project.version.numeric}" /> </target> - <target name="nuget" depends="init nuspec"> - <exec basedir="${tools.dir}" workingdir="${build.dir}" program="NuGet.exe"> + <target name="nuget" depends="init nuget.set-properties nuspec"> + <!-- Prepare working dir with file needed by NHibernate.LinFu.nuspec --> + <copy file="${bin.dir}/NHibernate.ByteCode.LinFu.dll" todir="${nuget.workingdir}"/> + <copy file="${bin.dir}/NHibernate.ByteCode.LinFu.xml" todir="${nuget.workingdir}"/> + <copy todir="${nuget.workingdir}"> + <fileset basedir="${bin.dir}"> + <include name="LinFu*.*" /> + </fileset> + </copy> + + <exec basedir="${tools.dir}" workingdir="${nuget.workingdir}" program="NuGet.exe"> <arg value="pack" /> <arg value="${nuspec.destination.filename}" /> - <arg line="-o ${nugetdeploy.subdir}" /> </exec> </target> Modified: trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template 2011-03-14 20:21:30 UTC (rev 5473) @@ -16,8 +16,8 @@ </dependencies> </metadata> <files> - <file src="bin\net-3.5\NHibernate.ByteCode.LinFu.dll" target="lib\Net35" /> - <file src="bin\net-3.5\NHibernate.ByteCode.LinFu.xml" target="lib\Net35" /> - <file src="bin\net-3.5\LinFu*.*" target="lib\Net35" /> + <file src="NHibernate.ByteCode.LinFu.dll" target="lib\Net35" /> + <file src="NHibernate.ByteCode.LinFu.xml" target="lib\Net35" /> + <file src="LinFu*.*" target="lib\Net35" /> </files> </package> \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.ByteCode.Spring/ByteCode.build =================================================================== (Binary files differ) Modified: trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.Spring.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.Spring.nuspec.template 2011-03-14 04:16:20 UTC (rev 5472) +++ trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.Spring.nuspec.template 2011-03-14 20:21:30 UTC (rev 5473) @@ -16,8 +16,8 @@ </dependencies> </metadata> <files> - <file src="bin\net-3.5\NHibernate.ByteCode.Spring.dll" target="lib\Net35" /> - <file src="bin\net-3.5\NHibernate.ByteCode.Spring.xml" target="lib\Net35" /> - <file src="bin\net-3.5\Spring*.*" target="lib\Net35" /> + <file src="NHibernate.ByteCode.Spring.dll" target="lib\Net35" /> + <file src="NHibernate.ByteCode.Spring.xml" target="lib\Net35" /> + <file src="Spring*.*" target="lib\Net35" /> </files> </package> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-14 04:16:26
|
Revision: 5472 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5472&view=rev Author: patearl Date: 2011-03-14 04:16:20 +0000 (Mon, 14 Mar 2011) Log Message: ----------- Increased database compatibility of NH2302. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2302/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2302/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2302/Fixture.cs 2011-03-14 04:14:41 UTC (rev 5471) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2302/Fixture.cs 2011-03-14 04:16:20 UTC (rev 5472) @@ -1,10 +1,31 @@ -using NUnit.Framework; +using System.Data; +using NHibernate.Mapping; +using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH2302 { [TestFixture] public class Fixture : BugTestCase { + protected override void Configure(Cfg.Configuration configuration) + { + foreach (var cls in configuration.ClassMappings) + { + foreach (var prop in cls.PropertyIterator) + { + foreach (var col in prop.ColumnIterator) + { + if (col is Column) + { + var column = col as Column; + if (column.SqlType == "nvarchar(max)") + column.SqlType = Dialect.GetLongestTypeName(DbType.String); + } + } + } + } + } + protected override void OnTearDown() { CleanUp(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-14 04:14:47
|
Revision: 5471 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5471&view=rev Author: patearl Date: 2011-03-14 04:14:41 +0000 (Mon, 14 Mar 2011) Log Message: ----------- Dialect method to get longest storage type for a specified DbType. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs trunk/nhibernate/src/NHibernate/Dialect/TypeNames.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2011-03-13 23:44:34 UTC (rev 5470) +++ trunk/nhibernate/src/NHibernate/Dialect/Dialect.cs 2011-03-14 04:14:41 UTC (rev 5471) @@ -449,6 +449,16 @@ return result; } + /// <summary> + /// Gets the name of the longest registered type for a particular DbType. + /// </summary> + /// <param name="dbType"></param> + /// <returns></returns> + public virtual string GetLongestTypeName(DbType dbType) + { + return typeNames.GetLongest(dbType); + } + /// <summary> /// Get the name of the database type appropriate for casting operations /// (via the CAST() SQL function) for the given <see cref="SqlType"/> typecode. Modified: trunk/nhibernate/src/NHibernate/Dialect/TypeNames.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/TypeNames.cs 2011-03-13 23:44:34 UTC (rev 5470) +++ trunk/nhibernate/src/NHibernate/Dialect/TypeNames.cs 2011-03-14 04:14:41 UTC (rev 5471) @@ -93,6 +93,23 @@ return Replace(Get(typecode), size, precision, scale); } + /// <summary> + /// For types with a simple length, this method returns the definition + /// for the longest registered type. + /// </summary> + /// <param name="typecode"></param> + /// <returns></returns> + public string GetLongest(DbType typecode) + { + SortedList<int, string> map; + weighted.TryGetValue(typecode, out map); + + if (map != null && map.Count > 0) + return Replace(map.Values[map.Count - 1], map.Keys[map.Count - 1], 0, 0); + + return Get(typecode); + } + private static string Replace(string type, int size, int precision, int scale) { type = StringHelper.ReplaceOnce(type, LengthPlaceHolder, size.ToString()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 23:44:40
|
Revision: 5470 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5470&view=rev Author: patearl Date: 2011-03-13 23:44:34 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Caps fix... oops. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs 2011-03-13 23:17:23 UTC (rev 5469) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs 2011-03-13 23:44:34 UTC (rev 5470) @@ -80,7 +80,7 @@ using (ISession session = OpenSession()) { string top = ""; - if (Dialect.GetType().Name.StartsWith("Mssql")) + if (Dialect.GetType().Name.StartsWith("MsSql")) top = "top 5"; IList<Product> results = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 23:17:29
|
Revision: 5469 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5469&view=rev Author: patearl Date: 2011-03-13 23:17:23 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Fixed NH1792. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs 2011-03-13 23:00:55 UTC (rev 5468) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs 2011-03-13 23:17:23 UTC (rev 5469) @@ -79,9 +79,13 @@ { using (ISession session = OpenSession()) { + string top = ""; + if (Dialect.GetType().Name.StartsWith("Mssql")) + top = "top 5"; + IList<Product> results = session.CreateCriteria<Product>().Add( - Expression.Sql("{alias}.Id in (Select p.Id from Product p order by Name)")).Add(Restrictions.Gt("Id", 0)). + Expression.Sql("{alias}.Id in (Select " + top + " p.Id from Product p order by Name)")).Add(Restrictions.Gt("Id", 0)). SetMaxResults(3).List<Product>(); Assert.AreEqual(3, results.Count); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 23:01:03
|
Revision: 5468 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5468&view=rev Author: patearl Date: 2011-03-13 23:00:55 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Tests: Improved support for SQLite in some tests. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1632/Fixture.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs trunk/nhibernate/src/NHibernate.Test/TestDialect.cs trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs 2011-03-13 04:56:18 UTC (rev 5467) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs 2011-03-13 23:00:55 UTC (rev 5468) @@ -23,6 +23,11 @@ get { return "NHibernate.Test"; } } + protected override bool AppliesTo(Dialect.Dialect dialect) + { + return TestDialect.GetTestDialect(dialect).SupportsDistributedTransactions; + } + [Test] public void WillNotCrashOnDtcPrepareFailure() { Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1632/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1632/Fixture.cs 2011-03-13 04:56:18 UTC (rev 5467) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1632/Fixture.cs 2011-03-13 23:00:55 UTC (rev 5468) @@ -31,7 +31,7 @@ using (var session = sessions.OpenSession()) using (var command = session.Connection.CreateCommand()) { - command.CommandText = "select next_hi from hibernate_unique_key with (updlock, rowlock)"; + command.CommandText = "select next_hi from hibernate_unique_key"; scalar1 = command.ExecuteScalar(); } @@ -52,7 +52,7 @@ using (var session = sessions.OpenSession()) using (var command = session.Connection.CreateCommand()) { - command.CommandText = "select next_hi from hibernate_unique_key with (updlock, rowlock)"; + command.CommandText = "select next_hi from hibernate_unique_key"; scalar2 = command.ExecuteScalar(); } @@ -174,6 +174,9 @@ [Test] public void When_using_two_sessions_with_explicit_flush() { + if (!TestDialect.SupportsConcurrentTransactions) + Assert.Ignore(Dialect.GetType().Name + " does not support concurrent transactions."); + object id1, id2; using (var tx = new TransactionScope()) { @@ -209,6 +212,9 @@ [Test] public void When_using_two_sessions() { + if (!TestDialect.SupportsConcurrentTransactions) + Assert.Ignore(Dialect.GetType().Name + " does not support concurrent transactions."); + object id1, id2; using (var tx = new TransactionScope()) { Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs 2011-03-13 04:56:18 UTC (rev 5467) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1792/Fixture.cs 2011-03-13 23:00:55 UTC (rev 5468) @@ -81,7 +81,7 @@ { IList<Product> results = session.CreateCriteria<Product>().Add( - Expression.Sql("{alias}.Id in (Select top 5 p.Id from Product p order by Name)")).Add(Restrictions.Gt("Id", 0)). + Expression.Sql("{alias}.Id in (Select p.Id from Product p order by Name)")).Add(Restrictions.Gt("Id", 0)). SetMaxResults(3).List<Product>(); Assert.AreEqual(3, results.Count); Modified: trunk/nhibernate/src/NHibernate.Test/TestDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/TestDialect.cs 2011-03-13 04:56:18 UTC (rev 5467) +++ trunk/nhibernate/src/NHibernate.Test/TestDialect.cs 2011-03-13 23:00:55 UTC (rev 5468) @@ -24,5 +24,14 @@ public virtual bool SupportsOperatorAll { get { return true; } } public virtual bool SupportsOperatorSome { get { return true; } } public virtual bool SupportsLocate { get { return true; } } + + public virtual bool SupportsDistributedTransactions { get { return true; } } + + /// <summary> + /// Whether two transactions can be run at the same time. For example, with SQLite + /// the database is locked when one transaction is run, so running a second transaction + /// will cause a "database is locked" error message. + /// </summary> + public virtual bool SupportsConcurrentTransactions { get { return true; } } } } Modified: trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs 2011-03-13 04:56:18 UTC (rev 5467) +++ trunk/nhibernate/src/NHibernate.Test/TestDialects/SQLiteTestDialect.cs 2011-03-13 23:00:55 UTC (rev 5468) @@ -21,5 +21,15 @@ { get { return false; } } + + public override bool SupportsDistributedTransactions + { + get { return false; } + } + + public override bool SupportsConcurrentTransactions + { + get { return false; } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 04:56:24
|
Revision: 5467 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5467&view=rev Author: patearl Date: 2011-03-13 04:56:18 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Tests: Improved compatibility of NH1443 test for SQLite. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs 2011-03-13 04:50:20 UTC (rev 5466) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1443/Fixture.cs 2011-03-13 04:56:18 UTC (rev 5467) @@ -17,11 +17,11 @@ if (Dialect.Dialect.GetDialect(cfg.Properties).SupportsIfExistsBeforeTableName) - Assert.That(script, Is.StringContaining("drop table if exists nhibernate.dbo.Aclass")); + Assert.That(script, Is.StringMatching("drop table if exists nhibernate.dbo.Aclass")); else - Assert.That(script, Is.StringContaining("drop table nhibernate.dbo.Aclass")); + Assert.That(script, Is.StringMatching("drop table nhibernate.dbo.Aclass")); - Assert.That(script, Is.StringContaining("create table nhibernate.dbo.Aclass")); + Assert.That(script, Is.StringMatching("create table nhibernate.dbo.Aclass")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 04:50:27
|
Revision: 5466 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5466&view=rev Author: patearl Date: 2011-03-13 04:50:20 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Implement Left function for SQLite and PostgreSQL. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1280/NH1280Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2011-03-13 04:07:31 UTC (rev 5465) +++ trunk/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs 2011-03-13 04:50:20 UTC (rev 5466) @@ -66,6 +66,7 @@ RegisterFunction("substring", new AnsiSubstringFunction()); RegisterFunction("replace", new StandardSQLFunction("replace", NHibernateUtil.String)); + RegisterFunction("left", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1,1,?2)")); RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))")); Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-13 04:07:31 UTC (rev 5465) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-13 04:50:20 UTC (rev 5466) @@ -63,6 +63,7 @@ RegisterFunction("date", new SQLFunctionTemplate(NHibernateUtil.Date, "datetime(date(?1))")); RegisterFunction("substring", new StandardSQLFunction("substr", NHibernateUtil.String)); + RegisterFunction("left", new SQLFunctionTemplate(NHibernateUtil.String, "substr(?1,1,?2)")); RegisterFunction("trim", new AnsiTrimEmulationFunction()); RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))")); Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1280/NH1280Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1280/NH1280Fixture.cs 2011-03-13 04:07:31 UTC (rev 5465) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1280/NH1280Fixture.cs 2011-03-13 04:50:20 UTC (rev 5466) @@ -224,8 +224,6 @@ [Test] public void SubstringShouldUseAllParameters() { - if(Dialect is PostgreSQLDialect) Assert.Ignore("The dialect {0} doesn't support LEFT function",Dialect.GetType().Name); - using (ISession s = OpenSession()) { using (ITransaction tx = s.BeginTransaction()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-13 04:07:37
|
Revision: 5465 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5465&view=rev Author: fabiomaulo Date: 2011-03-13 04:07:31 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Fixed script Modified Paths: -------------- trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.nuspec.template Modified: trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.nuspec.template =================================================================== --- trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.nuspec.template 2011-03-13 03:34:12 UTC (rev 5464) +++ trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.nuspec.template 2011-03-13 04:07:31 UTC (rev 5465) @@ -13,8 +13,8 @@ <tags>Collections</tags> </metadata> <files> - <file src="..\bin\net-3.5\Iesi.Collections.dll" target="lib\Net35" /> - <file src="..\bin\net-3.5\Iesi.Collections.pdb" target="lib\Net35" /> - <file src="..\bin\net-3.5\Iesi.Collections.license.txt" target="lib\Net35" /> + <file src="bin\net-3.5\Iesi.Collections.dll" target="lib\Net35" /> + <file src="bin\net-3.5\Iesi.Collections.pdb" target="lib\Net35" /> + <file src="bin\net-3.5\Iesi.Collections.license.txt" target="lib\Net35" /> </files> </package> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 03:34:18
|
Revision: 5464 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5464&view=rev Author: patearl Date: 2011-03-13 03:34:12 +0000 (Sun, 13 Mar 2011) Log Message: ----------- Tests: Fixed some mismatched test data. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/DbScripts/PostgreSQL82DialectLinqReadonlyCreateScript.sql trunk/nhibernate/src/NHibernate.Test/Linq/NorthwindDbCreator.cs Modified: trunk/nhibernate/src/NHibernate.Test/DbScripts/PostgreSQL82DialectLinqReadonlyCreateScript.sql =================================================================== (Binary files differ) Modified: trunk/nhibernate/src/NHibernate.Test/Linq/NorthwindDbCreator.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/NorthwindDbCreator.cs 2011-03-13 03:23:57 UTC (rev 5463) +++ trunk/nhibernate/src/NHibernate.Test/Linq/NorthwindDbCreator.cs 2011-03-13 03:34:12 UTC (rev 5464) @@ -62,7 +62,8 @@ { InvalidLoginAttempts = 6, LastLoginDate = DateTime.Now.AddDays(-1), - Enum1 = EnumStoredAsString.Medium + Enum1 = EnumStoredAsString.Medium, + Features = FeatureSet.HasAll } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-13 03:24:03
|
Revision: 5463 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5463&view=rev Author: fabiomaulo Date: 2011-03-13 03:23:57 +0000 (Sun, 13 Mar 2011) Log Message: ----------- creation of nuget push bat Modified Paths: -------------- trunk/nhibernate/default.build Modified: trunk/nhibernate/default.build =================================================================== --- trunk/nhibernate/default.build 2011-03-13 03:13:34 UTC (rev 5462) +++ trunk/nhibernate/default.build 2011-03-13 03:23:57 UTC (rev 5463) @@ -394,12 +394,11 @@ <target name="nuget" depends="init binaries nuspec" description="Creates files for the release on nuget gallery."> + <property name="nuget.conf-template" value="${build.dir}/NHibernateXmlConfigurationTemplates" /> - <copy file="releasenotes.txt" tofile="${build.dir}/NHibernate.releasenotes.txt"/> <copy file="readme.html" tofile="${build.dir}/NHibernate.readme.html"/> <copy file="lgpl.txt" tofile="${build.dir}/NHibernate.license.txt"/> - <!--Configuration templates--> <copy todir="${nuget.conf-template}"> <fileset basedir="src/NHibernate.Config.Templates"> @@ -413,6 +412,22 @@ <nant target="nuget"> <buildfiles refid="nugetfiles.all" /> </nant> + + <!--Create NuGet push bat --> + <copy file="${tools.dir}/NuGet.exe" todir="${build.dir}/${nugetdeploy.subdir}"/> + <property name="nugetdeploy.pushbatfile" value="${build.dir}/${nugetdeploy.subdir}/NuGetPush.bat" /> + + <echo message="rem The parameter is your NuGet access key ${environment::newline()}" file="${nugetdeploy.pushbatfile}" append="false"/> + <foreach item="File" property="filename"> + <in> + <items> + <include name="${build.dir}/${nugetdeploy.subdir}/*.nupkg"/> + </items> + </in> + <do> + <echo message="nuget push -source http://packages.nuget.org/v1/ ${filename} %1 ${environment::newline()}" file="${nugetdeploy.pushbatfile}" append="true"/> + </do> + </foreach> </target> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 03:13:40
|
Revision: 5462 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5462&view=rev Author: patearl Date: 2011-03-13 03:13:34 +0000 (Sun, 13 Mar 2011) Log Message: ----------- SQLite: Marked embedded function class as serializable. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-13 03:09:26 UTC (rev 5461) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-13 03:13:34 UTC (rev 5462) @@ -1,3 +1,4 @@ +using System; using System.Data; using System.Data.Common; using System.Text; @@ -255,6 +256,7 @@ get { return "select randomblob(16)"; } } + [Serializable] protected class SQLiteCastFunction : CastFunction { protected override bool CastingIsRequired(string sqlType) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-03-13 03:09:32
|
Revision: 5461 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5461&view=rev Author: patearl Date: 2011-03-13 03:09:26 +0000 (Sun, 13 Mar 2011) Log Message: ----------- SQLite: Improved cast function. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Dialect/Function/CastFunction.cs trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs Modified: trunk/nhibernate/src/NHibernate/Dialect/Function/CastFunction.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/Function/CastFunction.cs 2011-03-12 22:52:19 UTC (rev 5460) +++ trunk/nhibernate/src/NHibernate/Dialect/Function/CastFunction.cs 2011-03-13 03:09:26 UTC (rev 5461) @@ -71,17 +71,34 @@ { throw new QueryException(string.Format("invalid Hibernate type for cast(): type {0} not found", typeName)); } - return new SqlStringBuilder() - .Add("cast(") - .AddObject(args[0]) - .Add(" as ") - .Add(sqlType) - .Add(")") - .ToSqlString(); + + if (CastingIsRequired(sqlType)) + { + return new SqlStringBuilder() + .Add("cast(") + .AddObject(args[0]) + .Add(" as ") + .Add(sqlType) + .Add(")") + .ToSqlString(); + } + else + { + return new SqlStringBuilder() + .Add("(") + .AddObject(args[0]) + .Add(")") + .ToSqlString(); + } } #endregion + protected virtual bool CastingIsRequired(string sqlType) + { + return true; + } + #region IFunctionGrammar Members bool IFunctionGrammar.IsSeparator(string token) Modified: trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-12 22:52:19 UTC (rev 5460) +++ trunk/nhibernate/src/NHibernate/Dialect/SQLiteDialect.cs 2011-03-13 03:09:26 UTC (rev 5461) @@ -67,6 +67,8 @@ RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))")); RegisterFunction("iif", new SQLFunctionTemplate(null, "case when ?1 then ?2 else ?3 end")); + + RegisterFunction("cast", new SQLiteCastFunction()); } public override Schema.IDataBaseSchema GetDataBaseSchema(DbConnection connection) @@ -252,5 +254,16 @@ { get { return "select randomblob(16)"; } } + + protected class SQLiteCastFunction : CastFunction + { + protected override bool CastingIsRequired(string sqlType) + { + // SQLite doesn't support casting to datetime types. It assumes you want an integer and destroys the date string. + if (sqlType.ToLowerInvariant().Contains("date") || sqlType.ToLowerInvariant().Contains("time")) + return false; + return true; + } + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-12 22:52:26
|
Revision: 5460 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5460&view=rev Author: fabiomaulo Date: 2011-03-12 22:52:19 +0000 (Sat, 12 Mar 2011) Log Message: ----------- completed scripts to create nuget packages Modified Paths: -------------- trunk/nhibernate/default.build trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template Modified: trunk/nhibernate/default.build =================================================================== --- trunk/nhibernate/default.build 2011-03-12 22:06:36 UTC (rev 5459) +++ trunk/nhibernate/default.build 2011-03-12 22:52:19 UTC (rev 5460) @@ -278,7 +278,7 @@ <copy file="releasenotes.txt" todir="${bin-pack.tmpdir}"/> <copy file="readme.html" todir="${bin-pack.tmpdir}"/> - <copy file="lgpl.txt" todir="${bin-pack.tmpdir}"/> + <copy file="lgpl.txt" todir="${bin-pack.tmpdir}/NHibernate.license.txt"/> <copy file="gfdl.txt" todir="${bin-pack.tmpdir}"/> <copy file="HowInstall.txt" todir="${bin-pack.tmpdir}"/> @@ -394,7 +394,19 @@ <target name="nuget" depends="init binaries nuspec" description="Creates files for the release on nuget gallery."> - + <property name="nuget.conf-template" value="${build.dir}/NHibernateXmlConfigurationTemplates" /> + + <copy file="releasenotes.txt" tofile="${build.dir}/NHibernate.releasenotes.txt"/> + <copy file="readme.html" tofile="${build.dir}/NHibernate.readme.html"/> + <copy file="lgpl.txt" tofile="${build.dir}/NHibernate.license.txt"/> + + <!--Configuration templates--> + <copy todir="${nuget.conf-template}"> + <fileset basedir="src/NHibernate.Config.Templates"> + <include name="*"/> + </fileset> + </copy> + <property name="nugetdeploy.subdir" value="nuget_gallery" /> <mkdir dir="${build.dir}/${nugetdeploy.subdir}" /> Modified: trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-03-12 22:06:36 UTC (rev 5459) +++ trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-03-12 22:52:19 UTC (rev 5460) @@ -19,5 +19,9 @@ </metadata> <files> <file src="bin\net-3.5\NHibernate.dll" target="lib\Net35" /> + <file src="NHibernate.releasenotes.txt" target="lib\Net35" /> + <file src="NHibernate.readme.html" target="lib\Net35" /> + <file src="NHibernate.license.txt" target="lib\Net35" /> + <file src="NHibernateXmlConfigurationTemplates\*" target="lib\Net35\NHibernateXmlConfigurationTemplates" /> </files> </package> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-12 22:06:42
|
Revision: 5459 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5459&view=rev Author: fabiomaulo Date: 2011-03-12 22:06:36 +0000 (Sat, 12 Mar 2011) Log Message: ----------- - nuget targets: added NHibernate.ByteCode.Spring - fixed LinFu template - Fixed builds Modified Paths: -------------- trunk/nhibernate/default.build trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template trunk/nhibernate/src/NHibernate.ByteCode.Spring/ByteCode.build trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.ByteCode.Spring.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.Spring.nuspec.template Modified: trunk/nhibernate/default.build =================================================================== --- trunk/nhibernate/default.build 2011-03-12 21:49:42 UTC (rev 5458) +++ trunk/nhibernate/default.build 2011-03-12 22:06:36 UTC (rev 5459) @@ -383,6 +383,7 @@ <include name="NHibernate/NHibernate.build" /> <include name="NHibernate.ByteCode.Castle/ByteCode.build" /> <include name="NHibernate.ByteCode.LinFu/ByteCode.build" /> + <include name="NHibernate.ByteCode.Spring/ByteCode.build" /> </fileset> <target name="nuspec" depends="init" description="Create nuspec files"> Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build 2011-03-12 21:49:42 UTC (rev 5458) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build 2011-03-12 22:06:36 UTC (rev 5459) @@ -34,7 +34,7 @@ <target name="build" depends="init generate-assemblyinfo common.compile-dll" description="Build Castle ByteCode" /> <target name="nuspec" depends="init" description="Create nuspec for NHibernate.ByteCode.Castle"> - <property name="nuspec.destination.file" value="${build.dir}/nuspec.destination.filename" /> + <property name="nuspec.destination.file" value="${build.dir}/${nuspec.destination.filename}" /> <copy file="NHibernate.Castle.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/dependencies/dependency[@id = 'NHibernate']/@version" Modified: trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build 2011-03-12 21:49:42 UTC (rev 5458) +++ trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build 2011-03-12 22:06:36 UTC (rev 5459) @@ -34,7 +34,7 @@ <target name="build" depends="init generate-assemblyinfo common.compile-dll" description="Build LinFu ByteCode" /> <target name="nuspec" depends="init" description="Create nuspec for NHibernate.ByteCode.LinFu"> - <property name="nuspec.destination.file" value="${build.dir}/nuspec.destination.filename" /> + <property name="nuspec.destination.file" value="${build.dir}/${nuspec.destination.filename}" /> <copy file="NHibernate.LinFu.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/dependencies/dependency[@id = 'NHibernate']/@version" Modified: trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template 2011-03-12 21:49:42 UTC (rev 5458) +++ trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template 2011-03-12 22:06:36 UTC (rev 5459) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" ?> <package> <metadata> - <id>NHibernate.Castle</id> + <id>NHibernate.LinFu</id> <version>x.y.z</version> <authors>NHibernate community, Hibernate community</authors> <summary>NHibernate with lazy-loading enabled.</summary> Modified: trunk/nhibernate/src/NHibernate.ByteCode.Spring/ByteCode.build =================================================================== (Binary files differ) Modified: trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.ByteCode.Spring.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.ByteCode.Spring.csproj 2011-03-12 21:49:42 UTC (rev 5458) +++ trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.ByteCode.Spring.csproj 2011-03-12 22:06:36 UTC (rev 5459) @@ -93,6 +93,7 @@ </ItemGroup> <ItemGroup> <None Include="ByteCode.build" /> + <None Include="NHibernate.Spring.nuspec.template" /> </ItemGroup> <ItemGroup> <Folder Include="Properties\" /> Added: trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.Spring.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.Spring.nuspec.template (rev 0) +++ trunk/nhibernate/src/NHibernate.ByteCode.Spring/NHibernate.Spring.nuspec.template 2011-03-12 22:06:36 UTC (rev 5459) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" ?> +<package> + <metadata> + <id>NHibernate.Spring</id> + <version>x.y.z</version> + <authors>NHibernate community, Hibernate community</authors> + <summary>NHibernate with lazy-loading enabled.</summary> + <description> + NHibernate is a mature, open source object-relational mapper for the .NET framework. + This package enables the ability to use lazy-loading with Spring.NET AOP. + </description> + <language>en-US</language> + <tags>ORM, DataBase, DAL, Object Relational Mapping</tags> + <dependencies> + <dependency id="NHibernate" version="x.y.z" /> + </dependencies> + </metadata> + <files> + <file src="bin\net-3.5\NHibernate.ByteCode.Spring.dll" target="lib\Net35" /> + <file src="bin\net-3.5\NHibernate.ByteCode.Spring.xml" target="lib\Net35" /> + <file src="bin\net-3.5\Spring*.*" target="lib\Net35" /> + </files> +</package> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-12 21:49:48
|
Revision: 5458 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5458&view=rev Author: fabiomaulo Date: 2011-03-12 21:49:42 +0000 (Sat, 12 Mar 2011) Log Message: ----------- nuget targets: added NHibernate.ByteCode.LinFu Modified Paths: -------------- trunk/nhibernate/default.build trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.ByteCode.LinFu.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template Modified: trunk/nhibernate/default.build =================================================================== --- trunk/nhibernate/default.build 2011-03-12 20:34:46 UTC (rev 5457) +++ trunk/nhibernate/default.build 2011-03-12 21:49:42 UTC (rev 5458) @@ -382,6 +382,7 @@ <include name="Iesi.Collections/Iesi.Collections.build" /> <include name="NHibernate/NHibernate.build" /> <include name="NHibernate.ByteCode.Castle/ByteCode.build" /> + <include name="NHibernate.ByteCode.LinFu/ByteCode.build" /> </fileset> <target name="nuspec" depends="init" description="Create nuspec files"> Modified: trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build 2011-03-12 20:34:46 UTC (rev 5457) +++ trunk/nhibernate/src/NHibernate.ByteCode.LinFu/ByteCode.build 2011-03-12 21:49:42 UTC (rev 5458) @@ -6,7 +6,8 @@ xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd" > - <property name="root.dir" value="../.." /> + <property name="nuspec.destination.filename" value="NHibernate.LinFu.nuspec" /> + <property name="root.dir" value="../.." /> <include buildfile="${root.dir}/build-common/common-project.xml" /> <target name="init" depends="common.init"> @@ -31,5 +32,23 @@ <target name="generate-assemblyinfo" depends="init common.generate-assemblyinfo" /> <target name="build" depends="init generate-assemblyinfo common.compile-dll" description="Build LinFu ByteCode" /> + + <target name="nuspec" depends="init" description="Create nuspec for NHibernate.ByteCode.LinFu"> + <property name="nuspec.destination.file" value="${build.dir}/nuspec.destination.filename" /> + <copy file="NHibernate.LinFu.nuspec.template" tofile="${nuspec.destination.file}"/> + <xmlpoke file="${nuspec.destination.file}" + xpath="/package/metadata/dependencies/dependency[@id = 'NHibernate']/@version" + value="[${project.version.numeric}]" /> + <xmlpoke file="${nuspec.destination.file}" + xpath="/package/metadata/version" + value="${project.version.numeric}" /> + </target> + <target name="nuget" depends="init nuspec"> + <exec basedir="${tools.dir}" workingdir="${build.dir}" program="NuGet.exe"> + <arg value="pack" /> + <arg value="${nuspec.destination.filename}" /> + <arg line="-o ${nugetdeploy.subdir}" /> + </exec> + </target> </project> Modified: trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.ByteCode.LinFu.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.ByteCode.LinFu.csproj 2011-03-12 20:34:46 UTC (rev 5457) +++ trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.ByteCode.LinFu.csproj 2011-03-12 21:49:42 UTC (rev 5458) @@ -78,6 +78,7 @@ </ItemGroup> <ItemGroup> <None Include="ByteCode.build" /> + <None Include="NHibernate.LinFu.nuspec.template" /> </ItemGroup> <ItemGroup> <Folder Include="Properties\" /> Added: trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template (rev 0) +++ trunk/nhibernate/src/NHibernate.ByteCode.LinFu/NHibernate.LinFu.nuspec.template 2011-03-12 21:49:42 UTC (rev 5458) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" ?> +<package> + <metadata> + <id>NHibernate.Castle</id> + <version>x.y.z</version> + <authors>NHibernate community, Hibernate community</authors> + <summary>NHibernate with lazy-loading enabled.</summary> + <description> + NHibernate is a mature, open source object-relational mapper for the .NET framework. + This package enables the ability to use lazy-loading with LinFu dynamic-proxy. + </description> + <language>en-US</language> + <tags>ORM, DataBase, DAL, Object Relational Mapping</tags> + <dependencies> + <dependency id="NHibernate" version="x.y.z" /> + </dependencies> + </metadata> + <files> + <file src="bin\net-3.5\NHibernate.ByteCode.LinFu.dll" target="lib\Net35" /> + <file src="bin\net-3.5\NHibernate.ByteCode.LinFu.xml" target="lib\Net35" /> + <file src="bin\net-3.5\LinFu*.*" target="lib\Net35" /> + </files> +</package> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-12 20:34:52
|
Revision: 5457 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5457&view=rev Author: fabiomaulo Date: 2011-03-12 20:34:46 +0000 (Sat, 12 Mar 2011) Log Message: ----------- nuget targets: creation of packages (basic for now) Modified Paths: -------------- trunk/nhibernate/default.build trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.build trunk/nhibernate/src/NHibernate/NHibernate.build trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template Modified: trunk/nhibernate/default.build =================================================================== --- trunk/nhibernate/default.build 2011-03-12 19:21:54 UTC (rev 5456) +++ trunk/nhibernate/default.build 2011-03-12 20:34:46 UTC (rev 5457) @@ -378,16 +378,27 @@ </target> - <fileset id="nuspecfiles.all" basedir="src"> + <fileset id="nugetfiles.all" basedir="src"> <include name="Iesi.Collections/Iesi.Collections.build" /> <include name="NHibernate/NHibernate.build" /> <include name="NHibernate.ByteCode.Castle/ByteCode.build" /> </fileset> - <target name="nuspec" description="Create nuspec files"> + <target name="nuspec" depends="init" description="Create nuspec files"> <nant target="nuspec"> - <buildfiles refid="nuspecfiles.all" /> + <buildfiles refid="nugetfiles.all" /> </nant> </target> + + <target name="nuget" depends="init binaries nuspec" + description="Creates files for the release on nuget gallery."> + + <property name="nugetdeploy.subdir" value="nuget_gallery" /> + <mkdir dir="${build.dir}/${nugetdeploy.subdir}" /> + + <nant target="nuget"> + <buildfiles refid="nugetfiles.all" /> + </nant> + </target> </project> Modified: trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.build =================================================================== --- trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.build 2011-03-12 19:21:54 UTC (rev 5456) +++ trunk/nhibernate/src/Iesi.Collections/Iesi.Collections.build 2011-03-12 20:34:46 UTC (rev 5457) @@ -6,7 +6,8 @@ xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd" > - <property name="root.dir" value="../.." /> + <property name="nuspec.destination.filename" value="Iesi.Collections.nuspec" /> + <property name="root.dir" value="../.." /> <include buildfile="${root.dir}/build-common/common-project.xml" /> <target name="init" depends="common.init"> @@ -35,10 +36,19 @@ <target name="build" depends="init generate-assemblyinfo common.compile-dll" description="Build Iesi.Collections" /> <target name="nuspec" depends="init" description="Create nuspec for Iesi.Collections"> - <property name="nuspec.destination.file" value="${build.dir}/Iesi.Collections.nuspec" /> + <property name="nuspec.destination.file" value="${build.dir}/${nuspec.destination.filename}" /> <copy file="Iesi.Collections.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/version" value="${project.version.numeric}" /> </target> + + <target name="nuget" depends="init nuspec"> + <exec basedir="${tools.dir}" workingdir="${build.dir}" program="NuGet.exe"> + <arg value="pack" /> + <arg value="${nuspec.destination.filename}" /> + <arg line="-o ${nugetdeploy.subdir}" /> + </exec> + </target> + </project> Modified: trunk/nhibernate/src/NHibernate/NHibernate.build =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.build 2011-03-12 19:21:54 UTC (rev 5456) +++ trunk/nhibernate/src/NHibernate/NHibernate.build 2011-03-12 20:34:46 UTC (rev 5457) @@ -6,7 +6,8 @@ xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd" > - <property name="root.dir" value="../.." /> + <property name="nuspec.destination.filename" value="NHibernate.nuspec" /> + <property name="root.dir" value="../.." /> <include buildfile="${root.dir}/build-common/common-project.xml" /> <target name="init" depends="common.init"> @@ -77,7 +78,7 @@ </target> <target name="nuspec" depends="init" description="Create nuspec for Iesi.Collections"> - <property name="nuspec.destination.file" value="${build.dir}/NHibernate.nuspec" /> + <property name="nuspec.destination.file" value="${build.dir}/${nuspec.destination.filename}" /> <copy file="NHibernate.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/dependencies/dependency[@id = 'Iesi.Collections']/@version" @@ -87,4 +88,12 @@ value="${project.version.numeric}" /> </target> + <target name="nuget" depends="init nuspec"> + <exec basedir="${tools.dir}" workingdir="${build.dir}" program="NuGet.exe"> + <arg value="pack" /> + <arg value="${nuspec.destination.filename}" /> + <arg line="-o ${nugetdeploy.subdir}" /> + </exec> + </target> + </project> Modified: trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-03-12 19:21:54 UTC (rev 5456) +++ trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-03-12 20:34:46 UTC (rev 5457) @@ -18,6 +18,6 @@ </dependencies> </metadata> <files> - <file src="..\bin\net-3.5\NHibernate.dll" target="lib\Net35" /> + <file src="bin\net-3.5\NHibernate.dll" target="lib\Net35" /> </files> </package> \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build 2011-03-12 19:21:54 UTC (rev 5456) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle/ByteCode.build 2011-03-12 20:34:46 UTC (rev 5457) @@ -6,7 +6,8 @@ xmlns="http://nant.sf.net/release/0.85-rc3/nant.xsd" > - <property name="root.dir" value="../.." /> + <property name="nuspec.destination.filename" value="NHibernate.Castle.nuspec" /> + <property name="root.dir" value="../.." /> <include buildfile="${root.dir}/build-common/common-project.xml" /> <target name="init" depends="common.init"> @@ -33,7 +34,7 @@ <target name="build" depends="init generate-assemblyinfo common.compile-dll" description="Build Castle ByteCode" /> <target name="nuspec" depends="init" description="Create nuspec for NHibernate.ByteCode.Castle"> - <property name="nuspec.destination.file" value="${build.dir}/NHibernate.Castle.nuspec" /> + <property name="nuspec.destination.file" value="${build.dir}/nuspec.destination.filename" /> <copy file="NHibernate.Castle.nuspec.template" tofile="${nuspec.destination.file}"/> <xmlpoke file="${nuspec.destination.file}" xpath="/package/metadata/dependencies/dependency[@id = 'NHibernate']/@version" @@ -42,5 +43,12 @@ xpath="/package/metadata/version" value="${project.version.numeric}" /> </target> + <target name="nuget" depends="init nuspec"> + <exec basedir="${tools.dir}" workingdir="${build.dir}" program="NuGet.exe"> + <arg value="pack" /> + <arg value="${nuspec.destination.filename}" /> + <arg line="-o ${nugetdeploy.subdir}" /> + </exec> + </target> </project> Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template 2011-03-12 19:21:54 UTC (rev 5456) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template 2011-03-12 20:34:46 UTC (rev 5457) @@ -17,7 +17,7 @@ </dependencies> </metadata> <files> - <file src="..\bin\net-3.5\NHibernate.ByteCode.Castle.dll" target="lib\Net35" /> - <file src="..\bin\net-3.5\NHibernate.ByteCode.Castle.xml" target="lib\Net35" /> + <file src="bin\net-3.5\NHibernate.ByteCode.Castle.dll" target="lib\Net35" /> + <file src="bin\net-3.5\NHibernate.ByteCode.Castle.xml" target="lib\Net35" /> </files> </package> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-12 19:22:00
|
Revision: 5456 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5456&view=rev Author: fabiomaulo Date: 2011-03-12 19:21:54 +0000 (Sat, 12 Mar 2011) Log Message: ----------- NuGet command-line tool Added Paths: ----------- trunk/nhibernate/Tools/NuGet.exe Added: trunk/nhibernate/Tools/NuGet.exe =================================================================== (Binary files differ) Property changes on: trunk/nhibernate/Tools/NuGet.exe ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-12 19:18:21
|
Revision: 5455 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5455&view=rev Author: fabiomaulo Date: 2011-03-12 19:18:15 +0000 (Sat, 12 Mar 2011) Log Message: ----------- Minor Modified Paths: -------------- trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template Modified: trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-03-12 18:58:14 UTC (rev 5454) +++ trunk/nhibernate/src/NHibernate/NHibernate.nuspec.template 2011-03-12 19:18:15 UTC (rev 5455) @@ -4,6 +4,7 @@ <id>NHibernate</id> <version>x.y.z</version> <authors>NHibernate community, Hibernate community</authors> + <summary>NHibernate is a mature, open source object-relational mapper for the .NET framework.</summary> <description> DONT INSTALL IT DIRECTLY Only as reference for others frameworks. Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template 2011-03-12 18:58:14 UTC (rev 5454) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template 2011-03-12 19:18:15 UTC (rev 5455) @@ -4,8 +4,9 @@ <id>NHibernate.Castle</id> <version>x.y.z</version> <authors>NHibernate community, Hibernate community</authors> + <summary>NHibernate with lazy-loading enabled.</summary> <description> - NHibernate is a mature, open source object-relational mapper for the .NET framework. It's actively developed , fully featured and used in thousands of successful projects. + NHibernate is a mature, open source object-relational mapper for the .NET framework. This package enables the ability to use lazy-loading with Castle dynamic-proxy. </description> <language>en-US</language> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fab...@us...> - 2011-03-12 18:58:20
|
Revision: 5454 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5454&view=rev Author: fabiomaulo Date: 2011-03-12 18:58:14 +0000 (Sat, 12 Mar 2011) Log Message: ----------- nuget targets: added description to NHibernate.ByteCode.Castle Modified Paths: -------------- trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template Modified: trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template =================================================================== --- trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template 2011-03-12 18:55:47 UTC (rev 5453) +++ trunk/nhibernate/src/NHibernate.ByteCode.Castle/NHibernate.Castle.nuspec.template 2011-03-12 18:58:14 UTC (rev 5454) @@ -6,7 +6,7 @@ <authors>NHibernate community, Hibernate community</authors> <description> NHibernate is a mature, open source object-relational mapper for the .NET framework. It's actively developed , fully featured and used in thousands of successful projects. - + This package enables the ability to use lazy-loading with Castle dynamic-proxy. </description> <language>en-US</language> <tags>ORM, DataBase, DAL, Object Relational Mapping</tags> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |