private Mapping.Collection CreateMap(XmlNode node, string prefix, string path, PersistentClass owner, System.Type containingType) { Map map = new Map(owner); BindCollection(node, map, prefix, path, containingType); return map; }
private Mapping.Collection CreateMap(XmlNode node, string prefix, string path, PersistentClass owner, System.Type containingType, IDictionary<string, MetaAttribute> inheritedMetas) { Map map = new Map(owner); BindCollection(node, map, prefix, path, containingType, inheritedMetas); return map; }
private Mapping.Collection CreateMap(HbmMap mapMapping, string prefix, string path, PersistentClass owner, System.Type containingType, IDictionary<string, MetaAttribute> inheritedMetas) { var map = new Map(owner); BindCollection(mapMapping, map, prefix, path, containingType, inheritedMetas); AddMapSecondPass(mapMapping, map, inheritedMetas); return map; }
/// <summary> /// Called for Maps /// </summary> private void BindMapSecondPass(HbmMap mapMapping, Map model, IDictionary<string, PersistentClass> persistentClasses, IDictionary<string, MetaAttribute> inheritedMetas) { BindCollectionSecondPass(mapMapping, model, persistentClasses, inheritedMetas); HbmIndex indexMapping; HbmMapKey mapKeyMapping; HbmIndexManyToMany indexManyToManyMapping; HbmMapKeyManyToMany mapKeyManyToManyMapping; HbmCompositeIndex compositeIndexMapping; HbmCompositeMapKey compositeMapKeyMapping; HbmIndexManyToAny indexManyToAnyMapping; if ((indexMapping = mapMapping.Item as HbmIndex) != null) { var value = new SimpleValue(model.CollectionTable); new ValuePropertyBinder(value, Mappings).BindSimpleValue(indexMapping, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany); model.Index = value; if (string.IsNullOrEmpty(model.Index.TypeName)) throw new MappingException("map index element must specify a type: " + model.Role); } else if ((mapKeyMapping = mapMapping.Item as HbmMapKey) != null) { var value = new SimpleValue(model.CollectionTable); new ValuePropertyBinder(value, Mappings).BindSimpleValue(mapKeyMapping, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany); model.Index = value; if (string.IsNullOrEmpty(model.Index.TypeName)) throw new MappingException("map index element must specify a type: " + model.Role); } else if ((indexManyToManyMapping = mapMapping.Item as HbmIndexManyToMany) != null) { var manyToOne = new ManyToOne(model.CollectionTable); BindIndexManyToMany(indexManyToManyMapping, manyToOne, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany); model.Index = manyToOne; } else if ((mapKeyManyToManyMapping = mapMapping.Item as HbmMapKeyManyToMany) != null) { var manyToOne = new ManyToOne(model.CollectionTable); BindMapKeyManyToMany(mapKeyManyToManyMapping, manyToOne, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany); model.Index = manyToOne; } else if ((compositeIndexMapping = mapMapping.Item as HbmCompositeIndex) != null) { var component = new Component(model); BindComponent(compositeIndexMapping, component, null, null, model.Role + ".index", model.IsOneToMany, inheritedMetas); model.Index = component; } else if ((compositeMapKeyMapping = mapMapping.Item as HbmCompositeMapKey) != null) { var component = new Component(model); BindComponent(compositeMapKeyMapping, component, null, null, model.Role + ".index", model.IsOneToMany, inheritedMetas); model.Index = component; } else if ((indexManyToAnyMapping = mapMapping.Item as HbmIndexManyToAny) != null) { var any = new Any(model.CollectionTable); BindIndexManyToAny(indexManyToAnyMapping, any, model.IsOneToMany); model.Index = any; } bool indexIsFormula = model.Index.ColumnIterator.Any(x=> x.IsFormula); if (NeedBackref(model) && !indexIsFormula) { string entityName = ((OneToMany)model.Element).ReferencedEntityName; PersistentClass referenced = mappings.GetClass(entityName); var ib = new IndexBackref(); ib.Name = '_' + model.OwnerEntityName + "." + mapMapping.Name + "IndexBackref"; ib.IsUpdateable = false; ib.IsSelectable = false; ib.CollectionRole = model.Role; ib.EntityName = model.Owner.EntityName; ib.Value = model.Index; referenced.AddProperty(ib); } }
private void AddMapSecondPass(HbmMap mapMapping, Map model, IDictionary<string, MetaAttribute> inheritedMetas) { mappings.AddSecondPass(delegate(IDictionary<string, PersistentClass> persistentClasses) { PreCollectionSecondPass(model); BindMapSecondPass(mapMapping, model, persistentClasses, inheritedMetas); PostCollectionSecondPass(model); }); }
public override Mapping.Collection Create( XmlNode node, string prefix, string path, PersistentClass owner, Mappings mappings ) { Map map = new Map( owner ); Binder.BindCollection( node, map, prefix, path, mappings ); return map; }
public MapSecondPass( XmlNode node, Mappings mappings, Map collection ) : base( node, mappings, collection ) { }
/// <summary> /// Called for Maps /// </summary> /// <param name="node"></param> /// <param name="model"></param> /// <param name="classes"></param> /// <param name="mappings"></param> public static void BindMapSecondPass( XmlNode node, Map model, IDictionary classes, Mappings mappings ) { BindCollectionSecondPass( node, model, classes, mappings ); foreach( XmlNode subnode in node.ChildNodes ) { //I am only concerned with elements that are from the nhibernate namespace if( subnode.NamespaceURI != Configuration.MappingSchemaXMLNS ) { continue; } string name = subnode.LocalName; //.Name; if( "index".Equals( name ) ) { SimpleValue value = new SimpleValue( model.CollectionTable ); BindSimpleValue( subnode, value, model.IsOneToMany, IndexedCollection.DefaultIndexColumnName, mappings ); model.Index = value; if( model.Index.Type == null ) { throw new MappingException( "map index element must specify a type: " + model.Role ); } } else if( "index-many-to-many".Equals( name ) ) { ManyToOne mto = new ManyToOne( model.CollectionTable ); BindManyToOne( subnode, mto, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany, mappings ); model.Index = mto; } else if( "composite-index".Equals( name ) ) { Component component = new Component( model.CollectionTable ); BindComponent( subnode, component, null, model.Role, "index", model.IsOneToMany, mappings ); model.Index = component; } else if( "index-many-to-any".Equals( name ) ) { Any any = new Any( model.CollectionTable ); BindAny( subnode, any, model.IsOneToMany, mappings ); model.Index = any; } } }
/// <summary> /// Called for Maps /// </summary> private void BindMapSecondPass(HbmMap mapMapping, Map model, IDictionary<string, PersistentClass> persistentClasses, IDictionary<string, MetaAttribute> inheritedMetas) { BindCollectionSecondPass(mapMapping, model, persistentClasses, inheritedMetas); HbmIndex indexMapping; HbmMapKey mapKeyMapping; HbmIndexManyToMany indexManyToManyMapping; HbmMapKeyManyToMany mapKeyManyToManyMapping; HbmCompositeIndex compositeIndexMapping; HbmCompositeMapKey compositeMapKeyMapping; HbmIndexManyToAny indexManyToAnyMapping; if ((indexMapping = mapMapping.Item as HbmIndex) != null) { var value = new SimpleValue(model.CollectionTable); new ValuePropertyBinder(value, Mappings).BindSimpleValue(indexMapping, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany); model.Index = value; if (string.IsNullOrEmpty(model.Index.TypeName)) throw new MappingException("map index element must specify a type: " + model.Role); } else if ((mapKeyMapping = mapMapping.Item as HbmMapKey) != null) { var value = new SimpleValue(model.CollectionTable); new ValuePropertyBinder(value, Mappings).BindSimpleValue(mapKeyMapping, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany); model.Index = value; if (string.IsNullOrEmpty(model.Index.TypeName)) throw new MappingException("map index element must specify a type: " + model.Role); } else if ((indexManyToManyMapping = mapMapping.Item as HbmIndexManyToMany) != null) { var manyToOne = new ManyToOne(model.CollectionTable); BindIndexManyToMany(indexManyToManyMapping, manyToOne, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany); model.Index = manyToOne; } else if ((mapKeyManyToManyMapping = mapMapping.Item as HbmMapKeyManyToMany) != null) { var manyToOne = new ManyToOne(model.CollectionTable); BindMapKeyManyToMany(mapKeyManyToManyMapping, manyToOne, IndexedCollection.DefaultIndexColumnName, model.IsOneToMany); model.Index = manyToOne; } else if ((compositeIndexMapping = mapMapping.Item as HbmCompositeIndex) != null) { var component = new Component(model); BindComponent(compositeIndexMapping, component, null, null, model.Role + ".index", model.IsOneToMany, inheritedMetas); model.Index = component; } else if ((compositeMapKeyMapping = mapMapping.Item as HbmCompositeMapKey) != null) { var component = new Component(model); BindComponent(compositeMapKeyMapping, component, null, null, model.Role + ".index", model.IsOneToMany, inheritedMetas); model.Index = component; } else if ((indexManyToAnyMapping = mapMapping.Item as HbmIndexManyToAny) != null) { var any = new Any(model.CollectionTable); BindIndexManyToAny(indexManyToAnyMapping, any, model.IsOneToMany); model.Index = any; } }
private void AddMapSecondPass(XmlNode node, Map model) { mappings.AddSecondPass(delegate(IDictionary<string, PersistentClass> persistentClasses) { PreCollectionSecondPass(model); BindMapSecondPass(node, model, persistentClasses); PostCollectionSecondPass(model); }); }
private SetPropertiesEvent(MethodSig sig, Object bean, Map map) { this.sig = sig; this.bean = bean; this.map = map; }
public SetPropertiesEvent(Map map) : this(MethodSig.Map, null, map) { }