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: Michael D. <mik...@us...> - 2004-11-12 21:37:18
|
Update of /cvsroot/nhibernate/NHibernateContrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15409/NHibernateContrib Log Message: Directory /cvsroot/nhibernate/NHibernateContrib added to the repository |
From: Michael D. <mik...@us...> - 2004-11-11 22:39:39
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3538/src/NHibernate.DomainModel Modified Files: Tag: alpha_avalon-proxy ABC.hbm.xml Qux.cs Qux.hbm.xml WZ.hbm.xml Z.cs Log Message: updated to latest version of DynamicProxy Index: Qux.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Qux.hbm.xml,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** Qux.hbm.xml 9 Aug 2004 18:26:22 -0000 1.7 --- Qux.hbm.xml 11 Nov 2004 22:39:20 -0000 1.7.2.1 *************** *** 3,6 **** --- 3,7 ---- <class name="NHibernate.DomainModel.Qux, NHibernate.DomainModel" + proxy="NHibernate.DomainModel.Qux, NHibernate.DomainModel" table="quux" > Index: Qux.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Qux.cs,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** Qux.cs 9 Aug 2004 18:26:22 -0000 1.5 --- Qux.cs 11 Nov 2004 22:39:20 -0000 1.5.2.1 *************** *** 82,86 **** /// Gets or sets the _foo /// </summary> ! public FooProxy Foo { get { return _foo; } --- 82,86 ---- /// Gets or sets the _foo /// </summary> ! public virtual FooProxy Foo { get { return _foo; } *************** *** 91,95 **** /// Gets or sets the _created /// </summary> ! public bool Created { get { return _created; } --- 91,95 ---- /// Gets or sets the _created /// </summary> ! public virtual bool Created { get { return _created; } *************** *** 100,104 **** /// Gets or sets the _deleted /// </summary> ! public bool Deleted { get { return _deleted; } --- 100,104 ---- /// Gets or sets the _deleted /// </summary> ! public virtual bool Deleted { get { return _deleted; } *************** *** 109,113 **** /// Gets or sets the _loaded /// </summary> ! public bool Loaded { get { return _loaded; } --- 109,113 ---- /// Gets or sets the _loaded /// </summary> ! public virtual bool Loaded { get { return _loaded; } *************** *** 118,122 **** /// Gets or sets the _stored /// </summary> ! public bool Stored { get { return _stored; } --- 118,122 ---- /// Gets or sets the _stored /// </summary> ! public virtual bool Stored { get { return _stored; } *************** *** 127,131 **** /// Gets or sets the _key /// </summary> ! public long Key { get { return _key; } --- 127,131 ---- /// Gets or sets the _key /// </summary> ! public virtual long Key { get { return _key; } *************** *** 133,137 **** } ! public long TheKey { set { _key = value; } --- 133,137 ---- } ! public virtual long TheKey { set { _key = value; } *************** *** 141,145 **** /// Gets or sets the _stuff /// </summary> ! public string Stuff { get { return _stuff; } --- 141,145 ---- /// Gets or sets the _stuff /// </summary> ! public virtual string Stuff { get { return _stuff; } *************** *** 150,154 **** /// Gets or sets the _fums (<set>) /// </summary> ! public IDictionary Fums { get { return _fums; } --- 150,154 ---- /// Gets or sets the _fums (<set>) /// </summary> ! public virtual IDictionary Fums { get { return _fums; } *************** *** 159,163 **** /// Gets or sets the _moreFums /// </summary> ! public IList MoreFums { get { return _moreFums; } --- 159,163 ---- /// Gets or sets the _moreFums /// </summary> ! public virtual IList MoreFums { get { return _moreFums; } *************** *** 165,169 **** } ! public Qux Child { get --- 165,169 ---- } ! public virtual Qux Child { get *************** *** 180,184 **** /// Gets or sets the _childKey /// </summary> ! public long ChildKey { get { return _childKey; } --- 180,184 ---- /// Gets or sets the _childKey /// </summary> ! public virtual long ChildKey { get { return _childKey; } Index: WZ.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/WZ.hbm.xml,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** WZ.hbm.xml 11 Jul 2004 21:07:24 -0000 1.2 --- WZ.hbm.xml 11 Nov 2004 22:39:20 -0000 1.2.2.1 *************** *** 21,24 **** --- 21,25 ---- <class name="NHibernate.DomainModel.W, NHibernate.DomainModel" + proxy="NHibernate.DomainModel.Z, NHibernate.DomainModel" discriminator-value="0" > Index: Z.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Z.cs,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** Z.cs 3 Jun 2004 14:54:40 -0000 1.1 --- Z.cs 11 Nov 2004 22:39:20 -0000 1.1.2.1 *************** *** 11,15 **** private W _w; ! public long Id { get { return _id; } --- 11,15 ---- private W _w; ! public virtual long Id { get { return _id; } *************** *** 17,21 **** } ! public W W { get { return _w; } --- 17,21 ---- } ! public virtual W W { get { return _w; } Index: ABC.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/ABC.hbm.xml,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -C2 -d -r1.8.2.1 -r1.8.2.2 *** ABC.hbm.xml 5 Oct 2004 15:25:04 -0000 1.8.2.1 --- ABC.hbm.xml 11 Nov 2004 22:39:20 -0000 1.8.2.2 *************** *** 62,65 **** --- 62,66 ---- <class name="NHibernate.DomainModel.D, NHibernate.DomainModel" + proxy="NHibernate.DomainModel.D, NHibernate.DomainModel" discriminator-value="0" > |
From: Michael D. <mik...@us...> - 2004-11-11 22:37:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2876/src/NHibernate.Test Modified Files: Tag: alpha_avalon-proxy FooBarTest.cs Log Message: updated to latest version of DynamicProxy Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.67.2.2 retrieving revision 1.67.2.3 diff -C2 -d -r1.67.2.2 -r1.67.2.3 *** FooBarTest.cs 4 Oct 2004 01:42:46 -0000 1.67.2.2 --- FooBarTest.cs 11 Nov 2004 22:37:21 -0000 1.67.2.3 *************** *** 681,686 **** Assert.IsTrue(NHibernate.IsInitialized(f.TheFoo)); ! //TODO: this is initialized because Proxies are not implemented yet. ! //Assert.IsFalse( NHibernate.IsInitialized(f.component.Glarch) ); s.Delete(f.TheFoo); --- 681,685 ---- Assert.IsTrue(NHibernate.IsInitialized(f.TheFoo)); ! Assert.IsFalse( NHibernate.IsInitialized(f.Component.Glarch) ); s.Delete(f.TheFoo); *************** *** 1339,1358 **** } ! //TODO: once proxies is implemented get rid of the try-catch and notFound ! bool notFound = false; ! try ! { ! s.Load( typeof(Qux), (long)666 ); //nonexistent ! } ! catch(ObjectNotFoundException onfe) ! { ! notFound = true; ! Assert.IsNotNull(onfe, "should not find a Qux with id of 666 when Proxies are not implemented."); ! } ! Assert.IsTrue( ! notFound, ! "without proxies working - an ObjectNotFoundException should have been thrown. " + ! "If Proxies are implemented then you need to change this code" ! ); Assert.AreEqual( 1, s.Delete("from g in class Glarch") ); --- 1338,1343 ---- } ! s.Load( typeof(Qux), (long)666 ); //nonexistent ! Assert.AreEqual( 1, s.Delete("from g in class Glarch") ); *************** *** 1367,1388 **** stream.Close(); ! //TODO: once proxies is implemented get rid of the try-catch and notFound ! notFound = false; ! try ! { ! s.Load( typeof(Qux), (long)666 ) ; //nonexistent ! } ! catch(HibernateException he) ! { ! notFound = true; ! Assert.IsNotNull( he, "should have a session disconnected error when finding a Qux with id of 666 and Proxies are not implemented."); ! } ! Assert.IsTrue( ! notFound, ! "without proxies working - an ADOException/HibernateException should have been thrown. " + ! "If Proxies are implemented then you need to change this code because the ISession does " + ! "not need to be connected to the db when building a Proxy." ! ); ! s.Close(); } --- 1352,1357 ---- stream.Close(); ! s.Load( typeof(Qux), (long)666 ) ; //nonexistent ! s.Close(); } |
From: Michael D. <mik...@us...> - 2004-11-11 22:37:30
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2876/src/NHibernate.Test/NHSpecificTest Modified Files: Tag: alpha_avalon-proxy AvalonProxyFixture.cs Log Message: updated to latest version of DynamicProxy Index: AvalonProxyFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/Attic/AvalonProxyFixture.cs,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** AvalonProxyFixture.cs 4 Oct 2004 01:42:45 -0000 1.1.2.2 --- AvalonProxyFixture.cs 11 Nov 2004 22:37:21 -0000 1.1.2.3 *************** *** 60,64 **** // serialize and then deserialize the session. System.IO.Stream stream = new System.IO.MemoryStream(); ! System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); formatter.Serialize(stream, s); stream.Position = 0; --- 60,64 ---- // serialize and then deserialize the session. System.IO.Stream stream = new System.IO.MemoryStream(); ! System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter( ); formatter.Serialize(stream, s); stream.Position = 0; |
From: Michael D. <mik...@us...> - 2004-11-11 22:35:38
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2187/src/NHibernate/Proxy Modified Files: Tag: alpha_avalon-proxy INHibernateProxy.cs IProxyGenerator.cs LazyInitializer.cs ProxyGeneratorFactory.cs Added Files: Tag: alpha_avalon-proxy CastleCustomProxyGenerator.cs CastleLazyInitializer.cs CastleProxyGenerator.cs Removed Files: Tag: alpha_avalon-proxy AvalonLazyInitializer.cs AvalonProxyDeserializer.cs AvalonProxyGenerator.cs Log Message: updated to latest version of DynamicProxy --- AvalonProxyGenerator.cs DELETED --- Index: IProxyGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Proxy/Attic/IProxyGenerator.cs,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** IProxyGenerator.cs 5 Oct 2004 15:25:05 -0000 1.1.2.3 --- IProxyGenerator.cs 11 Nov 2004 22:34:57 -0000 1.1.2.4 *************** *** 13,17 **** /// <summary> ! /// Build a proxy using the Apache.Avalon.DynamicProxy library. /// </summary> /// <param name="persistentClass">The PersistentClass to proxy.</param> --- 13,17 ---- /// <summary> ! /// Build a proxy using the Castle.DynamicProxy library. /// </summary> /// <param name="persistentClass">The PersistentClass to proxy.</param> Index: INHibernateProxy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Proxy/Attic/INHibernateProxy.cs,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** INHibernateProxy.cs 27 Sep 2004 03:42:03 -0000 1.1.2.1 --- INHibernateProxy.cs 11 Nov 2004 22:34:57 -0000 1.1.2.2 *************** *** 6,11 **** /// <summary> /// A marker interface so NHibernate can know if it is dealing with ! /// an object that is a Proxy. All NHibernate Proxies will be Serializable. ! /// This does not mean that all Mapped Classes have to be Serializable. /// </summary> /// <remarks> --- 6,10 ---- /// <summary> /// A marker interface so NHibernate can know if it is dealing with ! /// an object that is a Proxy. /// </summary> /// <remarks> *************** *** 14,18 **** /// the Proxies are created in a seperate DLL than NHibernate. /// </remarks> ! public interface INHibernateProxy : ISerializable { } --- 13,17 ---- /// the Proxies are created in a seperate DLL than NHibernate. /// </remarks> ! public interface INHibernateProxy { } --- NEW FILE: CastleProxyGenerator.cs --- using System; using System.Collections; using System.Reflection; using System.Reflection.Emit; using Castle.DynamicProxy; using Castle.DynamicProxy.Builder; using Castle.DynamicProxy.Builder.CodeGenerators; using NHibernate.Engine; namespace NHibernate.Proxy { /// <summary> /// An <see cref="IProxyGenerator"/> that uses the Castle.DynamicProxy library. /// </summary> public class CastleProxyGenerator : IProxyGenerator { private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(CastleProxyGenerator) ); // key = mapped type // value = proxy type private IDictionary cachedProxyTypes; private GeneratorContext _context; private ModuleScope _scope; /// <summary> /// Initializes a new instance of the <see cref="CastleProxyGenerator"/> class. /// </summary> internal CastleProxyGenerator() { cachedProxyTypes = new Hashtable(); _scope = new ModuleScope(); // the EnhanceTypeDelegate will add custom code gen that DynamicProxy does not provide // by default. _context = new GeneratorContext( );// new EnhanceTypeDelegate( EnhanceInterfaceType ), null ); } /// <summary> /// Marks the Proxy with the <see cref="SerializableAttribute"/>. /// </summary> /// <param name="mainType"></param> /// <param name="handlerFieldBuilder"></param> /// <param name="constructorBuilder"></param> /// <remarks> /// The proxy itself is not really serializable, it is replaced with a different object during /// serialization. This object knows how to recreate the proxy during the deserialization /// process. /// </remarks> private void EnhanceInterfaceType(TypeBuilder mainType, FieldBuilder handlerFieldBuilder, ConstructorBuilder constructorBuilder) { bool isSerializableAttFound = false; System.Type baseType = mainType.BaseType; // I don't know why I can't find the [Serializable] on the generated type if( isSerializableAttFound==false ) { ConstructorInfo serAttConstructor = typeof(SerializableAttribute).GetConstructor( new System.Type[0] ); CustomAttributeBuilder serializableAttBuilder = new CustomAttributeBuilder( serAttConstructor, new object[0] ); mainType.SetCustomAttribute( serializableAttBuilder ); } } #region IProxyGenerator Methods /// <summary> /// Build a proxy using the Castle.DynamicProxy library. /// </summary> /// <param name="persistentClass">.</param> /// <param name="interfaces">The extra interfaces the Proxy should implement.</param> /// <param name="identifierPropertyInfo">The PropertyInfo to get/set the Id.</param> /// <param name="id">The value for the Id.</param> /// <param name="session">The Session the proxy is in.</param> /// <returns>A fully built <c>INHibernateProxy</c>.</returns> public INHibernateProxy GetProxy(System.Type persistentClass, System.Type concreteProxy, System.Type[] interfaces, PropertyInfo identifierPropertyInfo, object id, ISessionImplementor session) { object generatedProxy = null; try { CastleLazyInitializer initializer = new CastleLazyInitializer( persistentClass, concreteProxy, interfaces, id, identifierPropertyInfo, session ); System.Type proxyType = null; // if I try to generate a proxy twice for the same type the Castle library will do the same // in one ModuleBuilder. The ModuleBuilder throws an exception (not suprisingly) when you try // to define the same type twice in it. So nh needs to keep a cache of the proxy types that have // already been generated. lock( cachedProxyTypes.SyncRoot ) { proxyType = cachedProxyTypes[ concreteProxy ] as System.Type; // if the pc is an interface then we need to add the interface to the // interfaces array that was passed in because it only includes the extra // interfaces for that persistent class. //if( persistentClass.IsInterface ) if( concreteProxy.IsInterface ) { if( proxyType==null ) { //TODO: figure out if this is necessary because the concreteProxy is // already included in the interfaces array... System.Type[] temp = new System.Type[ interfaces.Length + 1 ]; interfaces.CopyTo( temp, 0 ); temp[ interfaces.Length ] = concreteProxy; //persistentClass; interfaces = temp; InterfaceProxyGenerator _interfaceGenerator = new InterfaceProxyGenerator( _scope, _context ); proxyType = _interfaceGenerator.GenerateCode( interfaces ); cachedProxyTypes[ concreteProxy ] = proxyType; } // don't understand why a Interface proxy requires 2 arg constructor and a Class Interface // proxy only requires 1 - TODO: email Hammett about this. // hack with new object() because an interface proxy is expecting an actual target instance - we // don't have that yet and don't want to create it until it is actually needed. generatedProxy = Activator.CreateInstance( proxyType, new object[] { initializer, new object() } ); } else { if( proxyType==null ) { CastleCustomProxyGenerator _classGenerator = new CastleCustomProxyGenerator( _scope, _context ); proxyType = _classGenerator.GenerateCode( concreteProxy ); cachedProxyTypes[ concreteProxy ] = proxyType; } generatedProxy = Activator.CreateInstance( proxyType, new object[] { initializer } ); } } //object generatedProxy = Activator.CreateInstance( proxyType, new object[] { initializer } ); return (INHibernateProxy)generatedProxy; } catch(Exception e) { log.Error("Castle Dynamic Class Generator failed", e); throw new HibernateException( "Castle Dynamic Class Generator failed", e); } } /// <summary> /// Gets the <see cref="LazyInitializer"/> that is used by the Proxy. /// </summary> /// <param name="proxy">The Proxy object</param> /// <returns>The <see cref="LazyInitializer"/> that contains the details of the Proxied object.</returns> public LazyInitializer GetLazyInitializer(INHibernateProxy proxy) { // have to hard code in "__interceptor" - very dependant on them not changing their // implementation - email Hammet about this - or atleast to provide a static // field object fieldValue = proxy.GetType().GetField( "__interceptor" ).GetValue( proxy ); return (LazyInitializer)fieldValue; } /// <summary> /// Convenience method to figure out the underlying type for the object regardless of it /// is a Proxied object or the real object. /// </summary> /// <param name="obj">The object to get the type of.</param> /// <returns>The Underlying Type for the object regardless of if it is a Proxy.</returns> public System.Type GetClass(object obj) { if (obj is INHibernateProxy) { INHibernateProxy proxy = (INHibernateProxy) obj; LazyInitializer li = GetLazyInitializer( proxy ); return li.PersistentClass; } else { return obj.GetType(); } } #endregion } } --- NEW FILE: CastleCustomProxyGenerator.cs --- using System; using System.Reflection.Emit; using Castle.DynamicProxy; using Castle.DynamicProxy.Builder.CodeBuilder; using Castle.DynamicProxy.Builder.CodeGenerators; namespace NHibernate.Proxy { /// <summary> /// This will build a proxy for a <see cref="System.Type"/> that is /// a <c>Class</c> and then add the <see cref="INHibernateProxy"/> /// interface to it. /// </summary> public class CastleCustomProxyGenerator : ClassProxyGenerator { public CastleCustomProxyGenerator(ModuleScope scope) : base(scope) { } public CastleCustomProxyGenerator(ModuleScope scope, GeneratorContext context) : base(scope, context) { } /// <summary> /// Override of the <see cref="BasicCodeGenerator.CreateTypeBuilder(System.Type, System.Type[])"/> implementation. /// </summary> /// <param name="baseType">The base <see cref="System.Type"/> for the Proxy.</param> /// <param name="interfaces">The extra <see cref="System.Type"/> interfaces for the Proxy to implement.</param> /// <returns>An <see cref="EasyType"/> with the required interfaces added.</returns> protected override EasyType CreateTypeBuilder(System.Type baseType, System.Type[] interfaces) { bool isImplemented = false; // check to see if this implements INHibernateProxy - if not then make it // implement the interface for( int i=0; i<interfaces.Length; i++) { if( interfaces[i].Equals( typeof(INHibernateProxy) ) ) { isImplemented = true; } } if( isImplemented==false ) { int length = interfaces.Length; System.Type[] newInterfaces = new System.Type[ length + 1 ]; Array.Copy( interfaces, 0, newInterfaces, 0, length ); newInterfaces[ length ] = typeof(INHibernateProxy); interfaces = newInterfaces; } return base.CreateTypeBuilder(baseType, interfaces); } } } Index: LazyInitializer.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Proxy/LazyInitializer.cs,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** LazyInitializer.cs 5 Oct 2004 15:34:49 -0000 1.1.2.5 --- LazyInitializer.cs 11 Nov 2004 22:34:57 -0000 1.1.2.6 *************** *** 18,21 **** --- 18,22 ---- /// to cglib was made in .net. /// </remarks> + [Serializable] public abstract class LazyInitializer { *************** *** 28,31 **** --- 29,33 ---- protected object _target = null; protected object _id; + [NonSerialized] protected ISessionImplementor _session; protected System.Type _persistentClass; *************** *** 104,108 **** /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> to write the object to.</param> ! protected abstract void AddSerializationInfo(SerializationInfo info); public object Identifier --- 106,112 ---- /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> to write the object to.</param> ! protected virtual void AddSerializationInfo(SerializationInfo info) ! { ! } public object Identifier *************** *** 176,179 **** --- 180,186 ---- { // all Proxies must implement INHibernateProxy which extends ISerializable + // not true anymore - DynamicProxy now handles the serialization. All Proxy + // Generators should make sure that ISerializable is implemented if their + // Proxy doesn't do it by default. if( method.Name.Equals("GetObjectData") ) { --- AvalonLazyInitializer.cs DELETED --- --- AvalonProxyDeserializer.cs DELETED --- Index: ProxyGeneratorFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Proxy/Attic/ProxyGeneratorFactory.cs,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** ProxyGeneratorFactory.cs 5 Oct 2004 15:25:05 -0000 1.1.2.3 --- ProxyGeneratorFactory.cs 11 Nov 2004 22:34:57 -0000 1.1.2.4 *************** *** 2,6 **** using System.Reflection; ! using Apache.Avalon.DynamicProxy; using NHibernate.Engine; --- 2,6 ---- using System.Reflection; ! using Castle.DynamicProxy; using NHibernate.Engine; *************** *** 15,19 **** private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(ProxyGeneratorFactory) ); ! private static IProxyGenerator _generator = new AvalonProxyGenerator(); public static IProxyGenerator GetProxyGenerator() --- 15,19 ---- private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(ProxyGeneratorFactory) ); ! private static IProxyGenerator _generator = new CastleProxyGenerator(); public static IProxyGenerator GetProxyGenerator() --- NEW FILE: CastleLazyInitializer.cs --- using System; using System.Collections; using System.Reflection; using System.Runtime.Serialization; using Castle.DynamicProxy; using NHibernate.Engine; namespace NHibernate.Proxy { /// <summary> /// A <see cref="LazyInitiliazer"/> for use with the Castle Dynamic Class Generator. /// </summary> [Serializable] public class CastleLazyInitializer : LazyInitializer, Castle.DynamicProxy.IInterceptor//, ISerializable { private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(CastleLazyInitializer) ); private System.Type _concreteProxy; private System.Type[] _interfaces; /// <summary> /// Initializes a new <see cref="CastleLazyInitializer"/> object. /// </summary> /// <param name="persistentClass">The Class to Proxy.</param> /// <param name="concreteProxy">The <see cref="System.Type"/> to use as the Proxy.</param> /// <param name="interfaces">An array of <see cref="System.Type"/> interfaces that the Proxy should implement.</param> /// <param name="id">The Id of the Object we are Proxying.</param> /// <param name="identifierPropertyInfo">The PropertyInfo for the <id> property.</param> /// <param name="session">The ISession this Proxy is in.</param> internal CastleLazyInitializer(System.Type persistentClass, System.Type concreteProxy, System.Type[] interfaces, object id, PropertyInfo identifierPropertyInfo, ISessionImplementor session) : base (persistentClass, id, identifierPropertyInfo, session) { _concreteProxy = concreteProxy; _interfaces = interfaces; } #region Castle.DynamicProxy.IInterceptor Members /// <summary> /// Invoke the actual Property/Method using the Proxy or instantiate the actual /// object and use it when the Proxy can't handle the method. /// </summary> /// <param name="invocation">The <see cref="IInvocation"/> from the generated Castle.DynamicProxy.</param> /// <param name="args">The parameters for the Method/Property</param> /// <returns>The result just like the actual object was called.</returns> public object Intercept(IInvocation invocation, params object[] args) { // let the generic LazyInitializer figure out if this can be handled // with the proxy or if the real class needs to be initialized object result = base.Invoke( invocation.Method, args); // the base LazyInitializer could not handle it so we need to Invoke // the method/property against the real class if( result==InvokeImplementation ) { invocation.InvocationTarget = GetImplementation(); return invocation.Proceed( args ); //return invocation.Method.Invoke( GetImplementation(), args ); } else { return result; } } #endregion } } |
From: Michael D. <mik...@us...> - 2004-11-11 22:35:16
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2187/src/NHibernate Modified Files: Tag: alpha_avalon-proxy NHibernate-1.1.csproj NHibernate.build Log Message: updated to latest version of DynamicProxy Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.48.2.3 retrieving revision 1.48.2.4 diff -C2 -d -r1.48.2.3 -r1.48.2.4 *** NHibernate-1.1.csproj 5 Oct 2004 15:25:03 -0000 1.48.2.3 --- NHibernate-1.1.csproj 11 Nov 2004 22:34:57 -0000 1.48.2.4 *************** *** 101,107 **** /> <Reference ! Name = "Apache.Avalon.DynamicProxy" ! AssemblyName = "Apache.Avalon.DynamicProxy" ! HintPath = "..\..\external-bin\Apache.Avalon.DynamicProxy.dll" /> </References> --- 101,107 ---- /> <Reference ! Name = "Castle.DynamicProxy" ! AssemblyName = "Castle.DynamicProxy" ! HintPath = "..\..\external-bin\Castle.DynamicProxy.dll" /> </References> *************** *** 1369,1388 **** /> <File ! RelPath = "Proxy\AvalonCustomProxyGenerator.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "Proxy\AvalonLazyInitializer.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Proxy\AvalonProxyDeserializer.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Proxy\AvalonProxyGenerator.cs" SubType = "Code" BuildAction = "Compile" --- 1369,1383 ---- /> <File ! RelPath = "Proxy\CastleCustomProxyGenerator.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Proxy\CastleLazyInitializer.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Proxy\CastleProxyGenerator.cs" SubType = "Code" BuildAction = "Compile" Index: NHibernate.build =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate.build,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** NHibernate.build 27 Sep 2004 03:41:45 -0000 1.1.2.1 --- NHibernate.build 11 Nov 2004 22:34:57 -0000 1.1.2.2 *************** *** 74,78 **** <includes name="System.XML.dll" /> <includes name="System.Data.dll" /> ! <includes name="Apache.Avalon.DynamicProxy.dll" /> <includes name="log4net.dll" /> <includes name="HashCodeProvider.dll" /> --- 74,78 ---- <includes name="System.XML.dll" /> <includes name="System.Data.dll" /> ! <includes name="Castle.DynamicProxy.dll" /> <includes name="log4net.dll" /> <includes name="HashCodeProvider.dll" /> |
From: Michael D. <mik...@us...> - 2004-11-11 22:34:12
|
Update of /cvsroot/nhibernate/nhibernate/external-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1949/external-bin Added Files: Tag: alpha_avalon-proxy Castle.DynamicProxy.dll Castle.DynamicProxy.license.txt Castle.DynamicProxy.pdb Removed Files: Tag: alpha_avalon-proxy Apache.Avalon.DynamicProxy.dll Apache.Avalon.DynamicProxy.license.txt Apache.Avalon.DynamicProxy.pdb Log Message: updated to latest version of DynamicProxy --- NEW FILE: Castle.DynamicProxy.pdb --- (This appears to be a binary file; contents omitted.) --- Apache.Avalon.DynamicProxy.dll DELETED --- --- NEW FILE: Castle.DynamicProxy.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Castle.DynamicProxy.license.txt --- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --- Apache.Avalon.DynamicProxy.license.txt DELETED --- --- Apache.Avalon.DynamicProxy.pdb DELETED --- |
From: Peter S. <sz...@us...> - 2004-11-09 15:11:15
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21594/nhibernate/src/NHibernate/Hql Modified Files: WhereParser.cs Log Message: This will fix enums ( where a.enumproperty = FQN.value) Index: WhereParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/WhereParser.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** WhereParser.cs 13 Sep 2004 04:51:05 -0000 1.22 --- WhereParser.cs 9 Nov 2004 15:11:05 -0000 1.23 *************** *** 490,494 **** throw new QueryException(me); } ! if (type == null) throw new QueryException("Could not determine type of: " + token); try { --- 490,501 ---- throw new QueryException(me); } ! if (type == null) ! { ! type = TypeFactory.HueristicType(constant.GetType().AssemblyQualifiedName); ! if (type == null) ! { ! throw new QueryException("Could not determine type of: " + token); ! } ! } try { |
From: Michael D. <mik...@us...> - 2004-11-08 18:34:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26619/NHibernate/Type Modified Files: GuidType.cs Log Message: Forgot to enclose Guid in single quotes for ObjectToSQLString Index: GuidType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/GuidType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GuidType.cs 25 Oct 2004 05:37:56 -0000 1.5 --- GuidType.cs 8 Nov 2004 18:33:57 -0000 1.6 *************** *** 45,49 **** public override string ObjectToSQLString(object value) { ! return value.ToString(); } --- 45,49 ---- public override string ObjectToSQLString(object value) { ! return "'" + value.ToString() + "'"; } |
From: Michael D. <mik...@us...> - 2004-11-08 02:55:50
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3615/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Working on finishing up the test with the code that already exists. Just have the huge test case of Query. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** FooBarTest.cs 4 Nov 2004 04:46:12 -0000 1.70 --- FooBarTest.cs 8 Nov 2004 02:55:39 -0000 1.71 *************** *** 1632,1644 **** [Test] - [Ignore("Test not written yet.")] public void Find() { } [Test] ! [Ignore("Test not written yet.")] public void Query() { } --- 1632,1766 ---- [Test] public void Find() { + ISession s = sessions.OpenSession(); + + // some code commented out in h2.0.3 + + Bar bar = new Bar(); + s.Save( bar ); + bar.BarString = "bar bar"; + bar.String = "xxx"; + Foo foo = new Foo(); + s.Save( foo ); + foo.String = "foo bar"; + s.Save( new Foo() ); + s.Save( new Bar() ); + + IList list1 = s.Find( "select foo from foo in class NHibernate.DomainModel.Foo where foo.String='foo bar'" ); + Assert.AreEqual( 1, list1.Count, "find size" ); + Assert.AreSame( foo, list1[0], "find ==" ); + + IList list2 = s.Find( "from foo in class NHibernate.DomainModel.Foo order by foo.String, foo.Date" ); + Assert.AreEqual( 4, list2.Count, "find size" ); + list1 = s.Find( "from foo in class NHibernate.DomainModel.Foo where foo.class='B'" ); + Assert.AreEqual( 2, list1.Count, "class special property" ); + list1 = s.Find( "from foo in class NHibernate.DomainModel.Foo where foo.class=NHibernate.DomainModel.Bar" ); + Assert.AreEqual( 2, list1.Count, "class special property" ); + list1 = s.Find( "from foo in class NHibernate.DomainModel.Foo where foo.class=Bar" ); + list2 = s.Find( "select bar from bar in class NHibernate.DomainModel.Bar, foo in class NHibernate.DomainModel.Foo where bar.String = foo.String and not bar=foo" ); + + Assert.AreEqual( 2, list1.Count, "class special property" ); + Assert.AreEqual( 1, list2.Count, "select from a subclass" ); + + Trivial t= new Trivial(); + s.Save( t ); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + list1 = s.Find( "from foo in class NHibernate.DomainModel.Foo where foo.String='foo bar'" ); + Assert.AreEqual( 1, list1.Count, "find count" ); + // There is an interbase bug that causes null integers to return as 0, also numeric precision is <=15 -h2.0.3 comment + Assert.IsTrue( ( (Foo)list1[0]).EqualsFoo( foo ), "find equals" ); + list2 = s.Find( "select foo from foo in class NHibernate.DomainModel.Foo" ); + Assert.AreEqual( 5, list2.Count, "find count" ); + IList list3 = s.Find( "from bar in class NHibernate.DomainModel.Bar where bar.BarString='bar bar'" ); + Assert.AreEqual( 1, list3.Count, "find count" ); + Assert.IsTrue( list2.Contains( list1[0] ) && list2.Contains( list2[0] ), "find same instance" ); + Assert.AreEqual( 1, s.Find( "from t in class NHibernate.DomainModel.Trivial").Count ); + s.Delete( "from t in class NHibernate.DomainModel.Trivial" ); + + list2 = s.Find( "from foo in class NHibernate.DomainModel.Foo where foo.Date = ?", new DateTime(2123,2,3), NHibernate.Date ); + Assert.AreEqual( 4, list2.Count, "find by date" ); + IEnumerator enumer = list2.GetEnumerator(); + while( enumer.MoveNext() ) + { + s.Delete( enumer.Current ); + } + + list2 = s.Find( "from foo in class NHibernate.DomainModel.Foo" ); + Assert.AreEqual( 0, list2.Count, "find deleted" ); + s.Flush(); + s.Close(); } [Test] ! [Ignore("Test not complete yet.")] public void Query() { + ISession s = sessions.OpenSession(); + Foo foo = new Foo(); + s.Save( foo ); + Foo foo2 = new Foo(); + s.Save( foo2 ); + foo.TheFoo = foo2; + + IList list = s.Find( "from Foo foo inner join fetch foo.TheFoo" ); + Foo foof = (Foo)list[0]; + Assert.IsTrue( NHibernate.IsInitialized( foof.TheFoo ) ); + + list = s.Find( "from Baz baz left outer join fetch baz.FooToGlarch" ); + + list = s.Find( "select foo, bar from Foo foo left outer join foo.TheFoo bar where foo = ?", + foo, + NHibernate.Entity( typeof(Foo) ) + ); + + object[] row1 = (object[])list[0]; + Assert.IsTrue( row1[0]==foo && row1[1]==foo2 ); + + s.Find( "select foo.TheFoo.TheFoo.String from foo in class Foo where foo.TheFoo = 'bar'" ); + s.Find( "select foo.TheFoo.TheFoo.TheFoo.String from foo in class Foo where foo.TheFoo.TheFoo = 'bar'" ); + s.Find( "select foo.TheFoo.TheFoo.String from foo in class Foo where foo.TheFoo.TheFoo.TheFoo.String = 'bar'" ); + // if( !( dialect is Dialect.HSQLDialect ) ) + // { + s.Find( "select foo.String from foo in class Foo where foo.TheFoo.TheFoo.TheFoo = foo.TheFoo.TheFoo" ); + // } + s.Find( "select foo.String from foo in class Foo where foo.TheFoo.TheFoo = 'bar' and foo.TheFoo.TheFoo.TheFoo = 'baz'" ); + s.Find( "select foo.String from foo in class Foo where foo.TheFoo.TheFoo.TheFoo.String = 'a' and foo.TheFoo.String = 'b'" ); + + s.Find( "from bar in class Bar, foo in elements(bar.Baz.FooArray)" ); + + if( dialect is Dialect.DB2Dialect ) + { + s.Find( "from foo in class Foo where lower( foo.TheFoo.String ) = 'foo'" ); + s.Find( "from foo in class Foo where lower( (foo.TheFoo.String || 'foo') || 'bar' ) = 'foo'" ); + s.Find( "from foo in class Foo where repeat( (foo.TheFoo.STring || 'foo') || 'bar', 2 ) = 'foo'" ); + s.Find( "From foo in class Bar where foo.TheFoo.Integer is not null and repeat( (foo.TheFoo.String || 'foo') || 'bar', (5+5)/2 ) = 'foo'" ); + s.Find( "From foo in class Bar where foo.TheFoo.Integer is not null or repeat( (foo.TheFoo.String || 'foo') || 'bar', (5+5)/2 ) = 'foo'" ); + } + + if( ( dialect is Dialect.SybaseDialect ) || ( dialect is Dialect.MsSql2000Dialect ) ) + { + s.Enumerable( "select baz from Baz as baz join baz.FooArray foo group by baz order by sum(foo.Float)" ); + } + + s.Find( "from Foo as foo where foo.Component.Glarch.Name is not null" ); + s.Find( "from Foo as foo left outer join foo.Component.Glarch as glarch where glarch.Name = 'foo'" ); + + list = s.Find( "from Foo" ); + Assert.AreEqual( 2, list.Count ); + Assert.IsTrue( list[0] is FooProxy ); + list = s.Find( "from Foo foo left outer join foo.TheFoo" ); + Assert.AreEqual( 2, list.Count ); + Assert.IsTrue( ( (object[])list[0])[0] is FooProxy ); + + s.Find( "From Foo, Bar" ); + s.Find( "from Baz baz left join baz.FooToGlarch, Bar bar join bar.TheFoo" ); + s.Find( "from Baz baz left join baz.FooToGlarch join baz.FooSet" ); + s.Find( "from Baz baz left join baz.FooToGlarch join fetch baz.FooSet foo left join fetch foo.TheFoo" ); + + //TODO: resume h2.0.3 - line 1613 } |
From: Michael D. <mik...@us...> - 2004-11-08 02:54:08
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3204/NHibernate/Impl Modified Files: SessionFactoryImpl.cs SessionImpl.cs Log Message: Minor xml comment changes and code formatting. Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** SessionImpl.cs 31 Oct 2004 04:31:00 -0000 1.46 --- SessionImpl.cs 8 Nov 2004 02:53:58 -0000 1.47 *************** *** 526,530 **** get { ! if (batcher==null) batcher = new NonBatchingBatcher(this); //TODO: should check something, no? return batcher; } --- 526,533 ---- get { ! if (batcher==null) ! { ! batcher = new NonBatchingBatcher(this); ! } return batcher; } Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** SessionFactoryImpl.cs 30 Oct 2004 14:41:54 -0000 1.35 --- SessionFactoryImpl.cs 8 Nov 2004 02:53:57 -0000 1.36 *************** *** 74,78 **** [NonSerialized] private IDictionary imports; [NonSerialized] private IDictionary properties; ! // TODO: figure out why this is commented out in nh and not h2.0.3 //[NonSerialized] private Templates templates; [NonSerialized] private IInterceptor interceptor; --- 74,79 ---- [NonSerialized] private IDictionary imports; [NonSerialized] private IDictionary properties; ! // templates are related to XmlDatabinder - nothing like that yet ! // in NHibernate. //[NonSerialized] private Templates templates; [NonSerialized] private IInterceptor interceptor; |
From: Michael D. <mik...@us...> - 2004-11-08 02:54:08
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3204/NHibernate/Loader Modified Files: Loader.cs Log Message: Minor xml comment changes and code formatting. Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Loader.cs 31 Oct 2004 04:31:00 -0000 1.38 --- Loader.cs 8 Nov 2004 02:53:55 -0000 1.39 *************** *** 103,108 **** /// </remarks> /// <param name="session"></param> ! /// <param name="values"></param> ! /// <param name="types"></param> /// <param name="optionalObject"></param> /// <param name="optionalID"></param> --- 103,107 ---- /// </remarks> /// <param name="session"></param> ! /// <param name="parameters"></param> /// <param name="optionalObject"></param> /// <param name="optionalID"></param> *************** *** 110,116 **** /// <param name="optionalCollectionOwner"></param> /// <param name="returnProxies"></param> - /// <param name="selection"></param> - /// <param name="namedParams"></param> - /// <param name="lockModes"></param> /// <returns></returns> private IList DoFind( --- 109,112 ---- |
From: Michael D. <mik...@us...> - 2004-11-08 00:18:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2397/Driver Modified Files: NDataReader.cs Added Files: DB2Driver.cs Log Message: NH-144: DB2Dialect and DB2Driver Index: NDataReader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/NDataReader.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NDataReader.cs 14 Sep 2004 17:49:54 -0000 1.3 --- NDataReader.cs 8 Nov 2004 00:18:06 -0000 1.4 *************** *** 432,438 **** public int GetOrdinal(string colName) { ! return (int)fieldNameToIndex[colName]; } public object GetValue(int rowIndex, int colIndex) { --- 432,459 ---- public int GetOrdinal(string colName) { ! // Martijn Boland, 20041106: perform a case-sensitive search first and if that returns ! // null, perform a case-insensitive search (as being described in the IDataRecord ! // interface, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataIDataRecordClassItemTopic1.asp. ! // This is necessary for databases that don't preserve the case of field names when ! // they are created without quotes (e.g. DB2, PostgreSQL). ! if( fieldNameToIndex[colName]!=null ) ! { ! return (int)fieldNameToIndex[ colName ]; ! } ! else ! { ! string colNameUpper = colName.ToUpper(); ! foreach( DictionaryEntry entry in fieldNameToIndex ) ! { ! if( entry.Key.ToString().ToUpper()==colNameUpper ) ! { ! return (int)entry.Value; ! } ! } ! throw new IndexOutOfRangeException( String.Format( "No column with the specified name was found: {0}.", colName ) ); ! } } + public object GetValue(int rowIndex, int colIndex) { --- NEW FILE: DB2Driver.cs --- using System; namespace NHibernate.Driver { /// <summary> /// A NHibernate Driver for using the IBM.Data.DB2 DataProvider. /// </summary> public class DB2Driver : DriverBase { private System.Type connectionType; private System.Type commandType; public DB2Driver() { connectionType = System.Type.GetType("IBM.Data.DB2.DB2Connection, IBM.Data.DB2"); commandType = System.Type.GetType("IBM.Data.DB2.DB2Command, IBM.Data.DB2"); } public override System.Type CommandType { get { return commandType; } } public override System.Type ConnectionType { get { return connectionType; } } public override bool UseNamedPrefixInSql { get { return false; } } public override bool UseNamedPrefixInParameter { get { return false; } } public override string NamedPrefix { get { return String.Empty; } } public override bool SupportsMultipleOpenReaders { get { return false; } } } } |
From: Michael D. <mik...@us...> - 2004-11-08 00:18:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2397/Dialect Modified Files: DB2Dialect.cs Log Message: NH-144: DB2Dialect and DB2Driver Index: DB2Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/DB2Dialect.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DB2Dialect.cs 26 Feb 2003 20:41:57 -0000 1.4 --- DB2Dialect.cs 8 Nov 2004 00:18:00 -0000 1.5 *************** *** 1,6 **** using System; using System.Data; ! namespace NHibernate.Dialect { /// <summary> --- 1,11 ---- using System; using System.Data; + using System.Text; ! using NHibernate.SqlCommand; ! using NHibernate.SqlTypes; ! ! namespace NHibernate.Dialect ! { /// <summary> *************** *** 9,87 **** public class DB2Dialect : Dialect { ! public DB2Dialect() { ! /* Type mapping in Java was: ! ! Types.BIT, "SMALLINT" ! Types.BIGINT, "BIGINT" ! Types.SMALLINT, "SMALLINT" ! Types.TINYINT, "SMALLINT" ! Types.INTEGER, "INTEGER" ! Types.CHAR, "CHAR(1)" ! Types.VARCHAR, "VARCHAR($l)" ! Types.FLOAT, "FLOAT" ! Types.DOUBLE, "DOUBLE" ! Types.DATE, "DATE" ! Types.TIME, "TIME" ! Types.TIMESTAMP, "TIMESTAMP" ! Types.VARBINARY, "VARCHAR($l) FOR BIT DATA" ! Types.NUMERIC, "NUMERIC(19, $l)" ! Types.BLOB, "BLOB($l)" ! Types.CLOB, "CLOB($l)" ! */ ! ! Register( DbType.Bit, "SMALLINT" ); ! Register( DbType.BigInt, "BIGINT" ); ! Register( DbType.SmallInt, "SMALLINT" ); Register( DbType.Int16, "SMALLINT" ); Register( DbType.Int32, "INTEGER" ); ! Register( DbType.AnsiStringFixedLength, "VARCHAR($l)" ); ! Register( DbType.Float, "FLOAT" ); ! Register( DbType.Real, "DOUBLE" ); ! Register( DbType.DateTime, "DATE" ); ! // register( Types.TIME, "TIME" ); ??? ! Register( DbType.Timestamp, "TIMESTAMP" ); ! Register( DbType.VarBinary, "VARCHAR($l) FOR BIT DATA" ); ! Register( DbType.Decimal, "NUMERIC(19, $l)" ); ! Register( DbType.Image, "BLOB($l)" ); ! Register( DbType.Text, "CLOB($l)" ); ! ! /* ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); ! getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); ! */ } ! ! public override string AddColumnString { get { return "add column"; } } ! public override bool DropConstraints { get { return false; } } ! public override bool SupportsIdentityColumns { get { return true; } } ! public override string IdentitySelectString { get { return "values IDENTITY_VAL_LOCAL()"; } } ! public override string IdentityColumnString { get { return "not null generated by default as identity"; } } ! public override string IdentityInsertString { get { return "default"; } } ! public override string GetSequenceNextValString(string sequenceName) { return "values nextval for " + sequenceName; } ! public override string GetCreateSequenceString(string sequenceName) { return "create sequence " + sequenceName; } ! public override string GetDropSequenceString(string sequenceName) { return string.Concat( "drop sequence ", sequenceName, " restrict" ); } ! public override bool SupportsSequences { get { return true; } } } } \ No newline at end of file --- 14,165 ---- public class DB2Dialect : Dialect { ! public DB2Dialect() ! { ! Register( DbType.AnsiStringFixedLength, "CHAR(254)"); ! Register( DbType.AnsiStringFixedLength, 254, "CHAR($1)" ); ! Register( DbType.AnsiString, "VARCHAR(254)" ); ! Register( DbType.AnsiString, 8000, "VARCHAR($1)" ); ! Register( DbType.AnsiString, 2147483647, "CLOB"); ! Register( DbType.Binary, 2147483647, "BLOB" ); ! Register( DbType.Boolean, "SMALLINT" ); ! Register( DbType.Byte, "SMALLINT" ); ! Register( DbType.Currency, "DECIMAL(16,4)"); ! Register( DbType.Date, "DATE"); ! Register( DbType.DateTime, "TIMESTAMP" ); ! Register( DbType.Decimal, "DECIMAL(19,5)" ); ! Register( DbType.Decimal, 19, "DECIMAL(19, $1)"); ! Register( DbType.Double, "DOUBLE" ); Register( DbType.Int16, "SMALLINT" ); Register( DbType.Int32, "INTEGER" ); ! Register( DbType.Int64, "BIGINT" ); ! Register( DbType.Single, "REAL" ); ! Register( DbType.StringFixedLength, "CHAR(254)"); ! Register( DbType.StringFixedLength, 254, "CHAR($1)"); ! Register( DbType.String, "VARCHAR(254)" ); ! Register( DbType.String, 8000, "VARCHAR($1)" ); ! Register( DbType.String, 2147483647, "CLOB" ); ! Register( DbType.Time, "TIME" ); ! ! DefaultProperties[Cfg.Environment.OuterJoin] = "true"; } ! ! public override string AddColumnString ! { get { return "add column"; } } ! ! public override bool DropConstraints ! { get { return false; } } ! ! public override bool SupportsIdentityColumns ! { get { return true; } } ! ! public override string IdentitySelectString ! { get { return "values IDENTITY_VAL_LOCAL()"; } } ! ! public override string IdentityColumnString ! { get { return "not null generated by default as identity"; } } ! ! public override string IdentityInsertString ! { get { return "default"; } } ! public override string GetSequenceNextValString(string sequenceName) ! { return "values nextval for " + sequenceName; } ! ! public override string GetCreateSequenceString(string sequenceName) ! { return "create sequence " + sequenceName; } ! ! public override string GetDropSequenceString(string sequenceName) ! { return string.Concat( "drop sequence ", sequenceName, " restrict" ); } ! public override bool SupportsSequences ! { get { return true; } } + + public override bool SupportsLimit + { + get { return true; } + } + + public override bool BindLimitParametersInReverseOrder + { + get { return false; } + } + + public override bool UseMaxForLimit + { + get { return true; } + } + + public override SqlString GetLimitString(SqlString querySqlString) + { + Parameter p1 = new Parameter(); + Parameter p2 = new Parameter(); + p1.Name = "p1"; + p1.SqlType = new Int16SqlType(); + p2.Name = "p2"; + p2.SqlType = new Int16SqlType(); + /* + * "select * from (select row_number() over(orderby_clause) as rownum, " + * querySqlString_without select + * " ) as tempresult where rownum between ? and ?" + */ + SqlStringBuilder pagingBuilder = new SqlStringBuilder(); + bool isInOrderBy = false; + StringBuilder orderByStringBuilder = new StringBuilder(); + + // build a new query and extract the order by part + foreach (object sqlPart in querySqlString.SqlParts) + { + string sqlPartString = sqlPart as string; + if (sqlPartString != null) + { + if (sqlPartString.ToLower().TrimStart().StartsWith("order by")) + { + isInOrderBy = true; + } + } + + if (isInOrderBy && sqlPart is string) + { + orderByStringBuilder.Append((string)sqlPart); + } + else + { + pagingBuilder.AddObject(sqlPart); + } + } + + string rownumClause = "rownumber() over(" + orderByStringBuilder.ToString() + ") as rownum, "; + // Add the rownum clause first, right after the original select + pagingBuilder.Insert(1, rownumClause); + // Add the rest + pagingBuilder.Insert(0, "select * from ("); + pagingBuilder.Add(") as tempresult "); + // Add the where clause + pagingBuilder.Add(" where rownum between "); + pagingBuilder.Add(p1); + pagingBuilder.Add(" and "); + pagingBuilder.Add(p2); + + return pagingBuilder.ToSqlString(); + } } } \ No newline at end of file |
From: Michael D. <mik...@us...> - 2004-11-08 00:18:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2397 Modified Files: NHibernate-1.1.csproj NHibernate.build Log Message: NH-144: DB2Dialect and DB2Driver Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** NHibernate-1.1.csproj 3 Nov 2004 14:44:56 -0000 1.58 --- NHibernate-1.1.csproj 8 Nov 2004 00:18:06 -0000 1.59 *************** *** 456,459 **** --- 456,464 ---- /> <File + RelPath = "Dialect\DB2Dialect.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Dialect\Dialect.cs" SubType = "Code" *************** *** 516,519 **** --- 521,529 ---- /> <File + RelPath = "Driver\DB2Driver.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Driver\DriverBase.cs" SubType = "Code" Index: NHibernate.build =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate.build,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NHibernate.build 13 Oct 2004 04:18:07 -0000 1.2 --- NHibernate.build 8 Nov 2004 00:18:06 -0000 1.3 *************** *** 57,61 **** <excludes name="Test/**/*.cs" /> <excludes name="Util/*Test.cs" /> - <excludes name="Dialect/DB2Dialect.cs" /> <excludes name="Dialect/HSQLDialect.cs" /> <excludes name="Dialect/InterbaseDialect.cs" /> --- 57,60 ---- |
From: Michael D. <mik...@us...> - 2004-11-04 04:46:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31543/NHibernate Modified Files: IQuery.cs Log Message: NH-143: QueryImpl can now guess type correctly when passing an enum into SetParamater(..., value) Index: IQuery.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/IQuery.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** IQuery.cs 4 Oct 2004 21:15:34 -0000 1.9 --- IQuery.cs 4 Nov 2004 04:46:13 -0000 1.10 *************** *** 3,12 **** using NHibernate.Type; ! namespace NHibernate { /// <summary> ! /// An object-oriented representation of a Hibernate query. /// </summary> /// <remarks> ! /// A <c>Query</c> instance is obtained by calling <c>ISession.CreateQuery()</c>. This interface /// exposes some extra functionality beyond that provided by <c>ISession.Iterate()</c> and /// <c>ISession.Find()</c>; --- 3,13 ---- using NHibernate.Type; ! namespace NHibernate ! { /// <summary> ! /// An object-oriented representation of a NHibernate query. /// </summary> /// <remarks> ! /// An <c>IQuery</c> instance is obtained by calling <c>ISession.CreateQuery()</c>. This interface /// exposes some extra functionality beyond that provided by <c>ISession.Iterate()</c> and /// <c>ISession.Find()</c>; *************** *** 15,28 **** /// <c>SetMaxResults()</c>, <c>SetFirstResult</c></item> /// <item>Named query parameters may be used</item> - /// <item>The results may be returned as an instance of <c>ScrollableResults</c></item> /// </list> /// <para> - /// Use of <c>SetFirstResult()</c> requires that the ADO driver implements scrollable record sets - /// </para> - /// <para> /// Named query parameters are tokens of the form <c>:name</c> in the query string. A value is bound ! /// to the <c>integer</c> parameter <c>:foo</c> by calling /// <code> ! /// SetParameter("foo", foo, Hibernate.Int32); /// </code> /// for example. A name may appear multiple times in the query string. --- 16,25 ---- /// <c>SetMaxResults()</c>, <c>SetFirstResult</c></item> /// <item>Named query parameters may be used</item> /// </list> /// <para> /// Named query parameters are tokens of the form <c>:name</c> in the query string. A value is bound ! /// to the <c>Int32</c> parameter <c>:foo</c> by calling /// <code> ! /// SetParameter("foo", foo, NHibernate.Int32); /// </code> /// for example. A name may appear multiple times in the query string. *************** *** 30,35 **** /// <para> /// JDBC-stype <c>?</c> parameters are also supported. To bind a value to a JDBC-style ! /// parameter use a set method that accepts an <c>int</c> positional argument (numbered from ! /// zero, contrary to JDBC). /// </para> /// <para> --- 27,32 ---- /// <para> /// JDBC-stype <c>?</c> parameters are also supported. To bind a value to a JDBC-style ! /// parameter use a set method that accepts an <c>int</c> positional argument - numbered from ! /// zero. /// </para> /// <para> *************** *** 37,41 **** /// </para> /// <para> ! /// Queries are executed by calling <c>List()</c>, <c>Scroll()</c>, or <c>Iterate()</c>. A query /// may be re-executed by subsequent invocations. Its lifespan is, however, bounded by the lifespan /// of the <c>ISession</c> that created it. --- 34,38 ---- /// </para> /// <para> ! /// Queries are executed by calling <c>List()</c> or <c>Iterate()</c>. A query /// may be re-executed by subsequent invocations. Its lifespan is, however, bounded by the lifespan /// of the <c>ISession</c> that created it. *************** *** 45,64 **** /// </para> /// </remarks> ! public interface IQuery { ! ! /// <summary> /// The query string /// </summary> ! string QueryString { ! get; ! } /// <summary> /// The Hibernate types of the query result set. /// </summary> ! IType[] ReturnTypes { ! get; ! } /// <summary> --- 42,56 ---- /// </para> /// </remarks> ! public interface IQuery ! { /// <summary> /// The query string /// </summary> ! string QueryString { get; } /// <summary> /// The Hibernate types of the query result set. /// </summary> ! IType[] ReturnTypes { get; } /// <summary> *************** *** 66,72 **** /// </summary> /// <value>The parameter names, in no particular order</value> ! string[] NamedParameters { ! get; ! } /// <summary> --- 58,62 ---- /// </summary> /// <value>The parameter names, in no particular order</value> ! string[] NamedParameters { get; } /// <summary> *************** *** 81,94 **** /// <summary> - /// Return the query results as <c>ScrollableResults</c>. The scrollability of the returned - /// results depends upon the ADO support for scrollable <c>ResultSet</c> - /// </summary> - /// <remarks> - /// Entities returned as results are initialized on demand. The first SQL query returns - /// identifier only. - /// </remarks> - //IScrollableResults GetScrollableResults(); - - /// <summary> /// Return the query results as a <c>IList</c>. If the query contains multiple results per row, /// the results are returned in an instance of <c>object[]</c>. --- 71,74 ---- |
From: Michael D. <mik...@us...> - 2004-11-04 04:46:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31543/NHibernate.Test Modified Files: FooBarTest.cs Log Message: NH-143: QueryImpl can now guess type correctly when passing an enum into SetParamater(..., value) Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** FooBarTest.cs 3 Nov 2004 03:37:05 -0000 1.69 --- FooBarTest.cs 4 Nov 2004 04:46:12 -0000 1.70 *************** *** 2377,2380 **** --- 2377,2407 ---- foo = (FooProxy)s.Load( typeof(Foo), id); Assert.AreEqual( FooStatus.OFF, foo.Status ); + s.Close(); + + // verify that SetEnum with named params works correctly + s = sessions.OpenSession(); + IQuery q = s.CreateQuery( "from Foo as f where f.Status = :status" ); + q.SetEnum( "status", FooStatus.OFF ); + IList results = q.List(); + Assert.AreEqual( 1, results.Count, "should have found 1" ); + foo = (Foo)results[0]; + + q = s.CreateQuery( "from Foo as f where f.Status = :status" ); + q.SetEnum( "status", FooStatus.ON ); + results = q.List(); + Assert.AreEqual( 0, results.Count, "no foo with status of ON" ); + + // try to have the Query guess the enum type + q = s.CreateQuery( "from Foo as f where f.Status = :status" ); + q.SetParameter( "status", FooStatus.OFF ); + results = q.List(); + Assert.AreEqual( 1, results.Count, "found the 1 result" ); + + // have the query guess the enum type in a ParameterList. + q = s.CreateQuery( "from Foo as f where f.Status in (:status)" ); + q.SetParameterList( "status", new FooStatus[] { FooStatus.OFF, FooStatus.ON } ); + results = q.List(); + Assert.AreEqual( 1, results.Count, "should have found the 1 foo" ); + s.Delete(foo); s.Flush(); |
From: Michael D. <mik...@us...> - 2004-11-04 04:46:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31543/NHibernate/Impl Modified Files: QueryImpl.cs Log Message: NH-143: QueryImpl can now guess type correctly when passing an enum into SetParamater(..., value) Index: QueryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/QueryImpl.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** QueryImpl.cs 31 Oct 2004 04:31:00 -0000 1.15 --- QueryImpl.cs 4 Nov 2004 04:46:13 -0000 1.16 *************** *** 259,274 **** } ! private IType GuessType(System.Type clazz) { ! string typename = clazz.Name; ! IType type = TypeFactory.HueristicType(typename); bool serializable = type!=null && type is SerializableType; ! if ( type==null || serializable ) { ! try { session.Factory.GetPersister(clazz); ! } catch (MappingException) { ! if (serializable) { return type; } ! else { throw new HibernateException("Could not determine a type for class: " + typename); } --- 259,281 ---- } ! private IType GuessType(System.Type clazz) ! { ! string typename = clazz.AssemblyQualifiedName; ! IType type = TypeFactory.HueristicType( typename ); bool serializable = type!=null && type is SerializableType; ! if ( type==null || serializable ) ! { ! try ! { session.Factory.GetPersister(clazz); ! } ! catch (MappingException) ! { ! if (serializable) ! { return type; } ! else ! { throw new HibernateException("Could not determine a type for class: " + typename); } *************** *** 276,280 **** return NHibernate.Entity(clazz); } ! else { return type; } --- 283,288 ---- return NHibernate.Entity(clazz); } ! else ! { return type; } |
From: Michael D. <mik...@us...> - 2004-11-03 14:45:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22916/NHibernate Modified Files: NHibernate-1.1.csproj Log Message: NH-32 : updated to latest MySql driver. Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** NHibernate-1.1.csproj 31 Oct 2004 04:30:59 -0000 1.57 --- NHibernate-1.1.csproj 3 Nov 2004 14:44:56 -0000 1.58 *************** *** 516,535 **** /> <File ! RelPath = "Driver\ByteFXDataDriver.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Driver\DriverBase.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Driver\FirebirdDriver.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Driver\IDriver.cs" SubType = "Code" BuildAction = "Compile" --- 516,535 ---- /> <File ! RelPath = "Driver\DriverBase.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Driver\FirebirdDriver.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Driver\IDriver.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Driver\MySqlDataDriver.cs" SubType = "Code" BuildAction = "Compile" |
From: Michael D. <mik...@us...> - 2004-11-03 14:45:10
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22916/NHibernate/Driver Added Files: MySqlDataDriver.cs Removed Files: ByteFXDataDriver.cs Log Message: NH-32 : updated to latest MySql driver. --- NEW FILE: MySqlDataDriver.cs --- using System; using System.Data; using System.Reflection; using NHibernate.Dialect; using NHibernate.SqlCommand; namespace NHibernate.Driver { /// <summary> /// The MySqlDataDriver Driver provides a database driver for MySql. /// </summary> /// <remarks> /// <p> /// In order to use this Driver you must have the Assembly <c>MySql.Data.dll</c> available for /// NHibernate to load it. The Assembly <c>ICSharpCode.SharpZipLib.dll</c> is also required by /// the Assembly <c>MySql.Data.dll</c>. /// </p> /// <p> /// Please check the products website <a href="http://www.mysql.com/products/connector/net/">http://www.mysql.com/products/connector/net/</a> /// for any updates and or documentation. /// </p> /// </remarks> public class MySqlDataDriver : DriverBase { private System.Type connectionType; private System.Type commandType; public MySqlDataDriver() { connectionType = System.Type.GetType("MySql.Data.MySqlClient.MySqlConnection, MySql.Data"); commandType = System.Type.GetType("MySql.Data.MySqlClient.MySqlCommand, MySql.Data"); } public override System.Type CommandType { get { return commandType; } } public override System.Type ConnectionType { get { return connectionType; } } /// <summary> /// MySqlData does not use named parameters in the sql. /// </summary> /// <value><c>false</c> becuase MySql uses <c>?</c> in the sql.</value> public override bool UseNamedPrefixInSql { get {return true;} } public override bool UseNamedPrefixInParameter { get {return true;} } public override string NamedPrefix { get {return "?";} } /// <summary> /// The ByteFX driver does NOT support more than 1 open IDataReader /// with only 1 IDbConnection. /// </summary> /// <value><c>false</c> - it is not supported.</value> public override bool SupportsMultipleOpenReaders { get { return false; } } // protected override IDbDataParameter GenerateParameter(IDbCommand command, string name, Parameter parameter, Dialect.Dialect dialect) // { // IDbDataParameter dbParam = command.CreateParameter(); // dbParam.DbType = parameter.SqlType.DbType; // // //dbParam.ParameterName = this.FormatNameForParameter(name); // // return dbParam; // } } } --- ByteFXDataDriver.cs DELETED --- |
From: Michael D. <mik...@us...> - 2004-11-03 14:45:09
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22916/NHibernate.Test Modified Files: App.config Log Message: NH-32 : updated to latest MySql driver. Index: App.config =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/App.config,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** App.config 24 Sep 2004 03:31:24 -0000 1.9 --- App.config 3 Nov 2004 14:44:55 -0000 1.10 *************** *** 12,15 **** --- 12,21 ---- value="2" /> + + <add + key="hibernate.use_outer_join" + value="false" + /> + --> <add *************** *** 17,20 **** --- 23,27 ---- value="NHibernate.Connection.DriverConnectionProvider" /> + <!-- The valid strings for Isolation can be found in the documentation for the System.Data.IsolationLevel *************** *** 39,43 **** value="Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI" /> ! <!-- This is the System.Data.OracleClient.dll provider for Oracle from MS --> <!-- --- 46,52 ---- value="Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI" /> ! ! <!-- --> ! <!-- This is the System.Data.OracleClient.dll provider for Oracle from MS --> <!-- *************** *** 57,77 **** --> - - <!-- - <add - key="hibernate.use_outer_join" - value="false" - /> - --> - <!-- This is the ByteFX.Data.dll provider for MySql --> <!-- <add key="hibernate.connection.driver_class" ! value="NHibernate.Driver.ByteFXDataDriver" /> <add key="hibernate.connection.connection_string" ! value="Database=test;Data Source=someip;User Id=someuser;Password=somepwd" /> <add --- 66,78 ---- --> <!-- This is the ByteFX.Data.dll provider for MySql --> <!-- <add key="hibernate.connection.driver_class" ! value="NHibernate.Driver.MySqlDataDriver" /> <add key="hibernate.connection.connection_string" ! value="Database=test;Data Source=someip;User Id=blah;Password=blah" /> <add *************** *** 79,83 **** value="NHibernate.Dialect.MySQLDialect" /> ! --> <!-- This is the Firebird configuration --> --- 80,84 ---- value="NHibernate.Dialect.MySQLDialect" /> ! --> <!-- This is the Firebird configuration --> *************** *** 125,130 **** <appender-ref ref="rollingFile" /> </root> ! ! <logger name="NHibernate.SqlCommand"> <level value="ERROR" /> </logger> --- 126,131 ---- <appender-ref ref="rollingFile" /> </root> ! ! <logger name="NHibernate.Impl.BatcherImpl"> <level value="ERROR" /> </logger> |
From: Michael D. <mik...@us...> - 2004-11-03 14:41:55
|
Update of /cvsroot/nhibernate/nhibernate/external-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22442 Added Files: .cvsignore Log Message: MySql changed their to license to GPL. Download it from their site instead of putting it in NHibernate's cvs. --- NEW FILE: .cvsignore --- MySql* .#* |
From: Michael D. <mik...@us...> - 2004-11-03 14:39:26
|
Update of /cvsroot/nhibernate/nhibernate/external-bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21925 Removed Files: ByteFX.Data.dll ByteFX.MySqlClient.dll Log Message: MySql changed their to license to GPL. Download it from their site instead of putting it in NHibernate's cvs. --- ByteFX.Data.dll DELETED --- --- ByteFX.MySqlClient.dll DELETED --- |
From: Michael D. <mik...@us...> - 2004-11-03 03:37:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10534/NHibernate/Type Modified Files: TimeType.cs Log Message: Moved TimeType to its own test classes in the NHSpecific area and out of the ported classes. MySql does not follow the DbType.Time docs so this will help to isolate failing tests to just that datatype. Index: TimeType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TimeType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TimeType.cs 19 Oct 2004 02:24:08 -0000 1.7 --- TimeType.cs 3 Nov 2004 03:37:06 -0000 1.8 *************** *** 7,19 **** /// <summary> ! /// Maps a System.DateTime Property to an DateTime column that only stores the Hours, Minutes, ! /// and Seconds of the DateTime. /// </summary> /// <remarks> ! /// This defaults the Year to 0001, the Month to 01, and the Day to 01 - that should not matter because /// using this Type indicates that you don't care about the Date portion of the DateTime. /// </remarks> public class TimeType : ValueTypeType, IIdentifierType, ILiteralType { internal TimeType() : base( new TimeSqlType() ) { --- 7,28 ---- /// <summary> ! /// Maps a <see cref="System.DateTime" /> Property to an DateTime column that only stores the ! /// Hours, Minutes, and Seconds of the DateTime as significant. /// </summary> /// <remarks> ! /// <para> ! /// This defaults the Date to "1753-01-01" - that should not matter because /// using this Type indicates that you don't care about the Date portion of the DateTime. + /// </para> + /// <para> + /// A more appropriate choice to store the duration/time is the <see cref="TimeSpanType"/>. + /// The underlying <see cref="DbType.Time"/> tends to be handled diffently by different + /// DataProviders. + /// </para> /// </remarks> public class TimeType : ValueTypeType, IIdentifierType, ILiteralType { + private static DateTime BaseDateValue = new DateTime( 1753, 01, 01 ); + internal TimeType() : base( new TimeSqlType() ) { *************** *** 23,27 **** { DateTime dbValue = Convert.ToDateTime(rs[index]); ! return new DateTime(1, 1, 1, dbValue.Hour, dbValue.Minute, dbValue.Second); } --- 32,36 ---- { DateTime dbValue = Convert.ToDateTime(rs[index]); ! return new DateTime(1753, 01, 01, dbValue.Hour, dbValue.Minute, dbValue.Second); } *************** *** 39,43 **** { IDataParameter parm = st.Parameters[index] as IDataParameter; ! if((DateTime)value<new DateTime(1753,1,1)) { parm.Value = DBNull.Value; --- 48,52 ---- { IDataParameter parm = st.Parameters[index] as IDataParameter; ! if( (DateTime)value < TimeType.BaseDateValue ) { parm.Value = DBNull.Value; |
From: Michael D. <mik...@us...> - 2004-11-03 03:37:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10534/NHibernate.Test Modified Files: FooBarTest.cs NHibernate.Test-1.1.csproj Log Message: Moved TimeType to its own test classes in the NHSpecific area and out of the ported classes. MySql does not follow the DbType.Time docs so this will help to isolate failing tests to just that datatype. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** FooBarTest.cs 30 Oct 2004 14:41:54 -0000 1.68 --- FooBarTest.cs 3 Nov 2004 03:37:05 -0000 1.69 *************** *** 1066,1070 **** [Test] - //[Ignore("Time Portions commented out - http://jira.nhibernate.org:8080/browse/NH-89")] public void PersistCollections() { --- 1066,1069 ---- *************** *** 1101,1106 **** baz.StringList[0] = "new value"; baz.StringSet = new Hashtable(); - //http://jira.nhibernate.org:8080/browse/NH-89 - // TODO: baz.TimeArray[2] = new DateTime( Assert.AreEqual( 1, baz.StringGlarchMap.Count ); --- 1100,1103 ---- *************** *** 1142,1147 **** Assert.AreEqual( "new value", baz.StringList[0], "changed element" ); Assert.AreEqual( 0, baz.StringSet.Count, "replaced set" ); - // todo: populate time array - //Assert.IsNotNull( baz.TimeArray[2], "array element changed" ); baz.StringSet.Add( "two", new object() ); --- 1139,1142 ---- *************** *** 2319,2328 **** [Test] - [Ignore("Test not written yet.")] - public void ArrayOfTimes() - { - } - - [Test] public void Components() { --- 2314,2317 ---- Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** NHibernate.Test-1.1.csproj 25 Oct 2004 06:48:03 -0000 1.48 --- NHibernate.Test-1.1.csproj 3 Nov 2004 03:37:06 -0000 1.49 *************** *** 336,339 **** --- 336,344 ---- /> <File + RelPath = "NHSpecificTest\BasicTimeFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "NHSpecificTest\BlobberInMemoryFixture.cs" SubType = "Code" |