From: Michael D. <mik...@us...> - 2004-06-04 19:59:38
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15717/Cfg Modified Files: Binder.cs Log Message: <idbag> is now converted to an IdentiferBag collection correctly. Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Binder.cs 11 May 2004 19:26:59 -0000 1.24 --- Binder.cs 4 Jun 2004 19:59:29 -0000 1.25 *************** *** 497,500 **** --- 497,504 ---- mappings.AddSecondPass( new SetSecondPass(node, mappings, (Set) model) ); } + else if (model is IdentifierCollection) + { + mappings.AddSecondPass( new IdentifierCollectionSecondPass(node, mappings, (IdentifierCollection) model) ); + } else { *************** *** 987,990 **** --- 991,1007 ---- } + public static void BindIdentifierCollectionSecondPass(XmlNode node, IdentifierCollection model, IDictionary persitentClasses, Mappings mappings) + { + BindCollectionSecondPass(node, model, persitentClasses, mappings); + + XmlNode subnode = node.SelectSingleNode(nsPrefix + ":collection-id", nsmgr); + Value id = new Value(model.Table); + BindValue(subnode, id, false, IdentifierCollection.DefaultIdentifierColumnName); + model.Identifier = id; + MakeIdentifier(subnode, id, mappings); + if ( !model.IsOneToMany ) model.CreatePrimaryKey(); + + } + //map binding *************** *** 1215,1221 **** } private class MapSecondPass : SecondPass { ! public MapSecondPass(XmlNode node, Mappings mappings, Mapping.Collection collection) : base(node, mappings, collection) { --- 1232,1251 ---- } + private class IdentifierCollectionSecondPass : SecondPass + { + public IdentifierCollectionSecondPass(XmlNode node, Mappings mappings, Mapping.IdentifierCollection collection) + : base(node, mappings, collection) + { + } + + public override void secondPass(IDictionary persistentClasses) + { + Binder.BindIdentifierCollectionSecondPass( node, (Mapping.IdentifierCollection) collection, persistentClasses, mappings); + } + } + private class MapSecondPass : SecondPass { ! public MapSecondPass(XmlNode node, Mappings mappings, Mapping.Map collection) : base(node, mappings, collection) { *************** *** 1229,1233 **** private class SetSecondPass : SecondPass { ! public SetSecondPass(XmlNode node, Mappings mappings, Mapping.Collection collection) : base(node, mappings, collection) { --- 1259,1263 ---- private class SetSecondPass : SecondPass { ! public SetSecondPass(XmlNode node, Mappings mappings, Mapping.Set collection) : base(node, mappings, collection) { *************** *** 1241,1245 **** private class ListSecondPass : SecondPass { ! public ListSecondPass(XmlNode node, Mappings mappings, Mapping.Collection collection) : base(node, mappings, collection) { --- 1271,1275 ---- private class ListSecondPass : SecondPass { ! public ListSecondPass(XmlNode node, Mappings mappings, Mapping.List collection) : base(node, mappings, collection) { *************** *** 1315,1319 **** } ! private static CollectionType IDBAG = new CollectionTypeBag("idbag"); private class CollectionTypeIdBag : CollectionType { --- 1345,1349 ---- } ! private static CollectionType IDBAG = new CollectionTypeIdBag("idbag"); private class CollectionTypeIdBag : CollectionType { |