private void AddArraySecondPass(HbmArray arrayMapping, Array model, IDictionary <string, MetaAttribute> inheritedMetas) { mappings.AddSecondPass(delegate(IDictionary <string, PersistentClass> persistentClasses) { PreCollectionSecondPass(model); BindArraySecondPass(arrayMapping, model, persistentClasses, inheritedMetas); PostCollectionSecondPass(model); }); }
private Mapping.Collection CreateArray(HbmArray arrayMapping, string prefix, string path, PersistentClass owner, System.Type containingType, IDictionary <string, MetaAttribute> inheritedMetas) { var array = new Array(owner); BindArray(arrayMapping, array, prefix, path, containingType, inheritedMetas); AddArraySecondPass(arrayMapping, array, inheritedMetas); return(array); }
private void BindArraySecondPass(HbmArray arrayMapping, List model, IDictionary <string, PersistentClass> persistentClasses, IDictionary <string, MetaAttribute> inheritedMetas) { BindCollectionSecondPass(arrayMapping, model, persistentClasses, inheritedMetas); // Index BindCollectionIndex(arrayMapping, model); if (arrayMapping.ListIndex != null && !string.IsNullOrEmpty(arrayMapping.ListIndex.@base)) { model.BaseIndex = Convert.ToInt32(arrayMapping.ListIndex.@base); } }
/// <remarks> /// Called for arrays and primitive arrays /// </remarks> private void BindArray(HbmArray arrayMapping, Array model, string prefix, string path, System.Type containingType, IDictionary <string, MetaAttribute> inheritedMetas) { BindCollection(arrayMapping, model, prefix, path, containingType, inheritedMetas); var att = arrayMapping.elementclass; if (att != null) { model.ElementClassName = GetQualifiedClassName(att, mappings); } else { HbmElement element; HbmOneToMany oneToMany; HbmManyToMany manyToMany; HbmCompositeElement compositeElement; if ((element = arrayMapping.ElementRelationship as HbmElement) != null) { string typeName; var typeAttribute = element.Type; if (typeAttribute != null) { typeName = typeAttribute.name; } else { throw new MappingException("type for <element> was not defined"); } IType type = TypeFactory.HeuristicType(typeName, null); if (type == null) { throw new MappingException("could not interpret type: " + typeName); } model.ElementClassName = type.ReturnedClass.AssemblyQualifiedName; } else if ((oneToMany = arrayMapping.ElementRelationship as HbmOneToMany) != null) { model.ElementClassName = GetQualifiedClassName(oneToMany.@class, mappings); } else if ((manyToMany = arrayMapping.ElementRelationship as HbmManyToMany) != null) { model.ElementClassName = GetQualifiedClassName(manyToMany.@class, mappings); } else if ((compositeElement = arrayMapping.ElementRelationship as HbmCompositeElement) != null) { model.ElementClassName = GetQualifiedClassName(compositeElement.@class, mappings); } } }