public IdBagMapper(System.Type ownerType, System.Type elementType, IAccessorPropertyMapper accessorMapper, HbmIdbag mapping) { if (ownerType == null) { throw new ArgumentNullException("ownerType"); } if (elementType == null) { throw new ArgumentNullException("elementType"); } if (mapping == null) { throw new ArgumentNullException("mapping"); } OwnerType = ownerType; ElementType = elementType; this.mapping = mapping; if (mapping.Key == null) { mapping.key = new HbmKey(); } keyMapper = new KeyMapper(ownerType, mapping.Key); if (mapping.collectionid == null) { mapping.collectionid = new HbmCollectionId(); } idMapper = new CollectionIdMapper(mapping.collectionid); entityPropertyMapper = accessorMapper; }
public ListMapper(System.Type ownerType, System.Type elementType, IAccessorPropertyMapper accessorMapper, HbmList mapping) { if (ownerType == null) { throw new ArgumentNullException("ownerType"); } if (elementType == null) { throw new ArgumentNullException("elementType"); } if (mapping == null) { throw new ArgumentNullException("mapping"); } OwnerType = ownerType; ElementType = elementType; this.mapping = mapping; if (mapping.Key == null) { mapping.key = new HbmKey(); } keyMapper = new KeyMapper(ownerType, mapping.Key); var listIndex = new HbmListIndex(); mapping.Item = listIndex; listIndexMapper = new ListIndexMapper(ownerType, listIndex); entityPropertyMapper = accessorMapper; }
public JoinedSubclassMapper(System.Type subClass, HbmMapping mapDoc) : base(subClass, mapDoc) { classMapping.name = subClass.GetShortClassName(mapDoc); classMapping.extends = subClass.BaseType.GetShortClassName(mapDoc); if (classMapping.key == null) { classMapping.key = new HbmKey { column1 = subClass.BaseType.Name.ToLowerInvariant() + "_key" }; } keyMapper = new KeyMapper(subClass, classMapping.key); mapDoc.Items = ArrayHelper.Append(mapDoc.Items, classMapping); }
public JoinedSubclassMapper(System.Type subClass, HbmMapping mapDoc) : base(subClass, mapDoc) { var toAdd = new[] { classMapping }; classMapping.name = subClass.GetShortClassName(mapDoc); classMapping.extends = subClass.BaseType.GetShortClassName(mapDoc); if (classMapping.key == null) { classMapping.key = new HbmKey { column1 = subClass.BaseType.Name.ToLowerInvariant() + "_key" }; } keyMapper = new KeyMapper(subClass, classMapping.key); mapDoc.Items = mapDoc.Items == null ? toAdd : mapDoc.Items.Concat(toAdd).ToArray(); }
public MapMapper(System.Type ownerType, System.Type keyType, System.Type valueType, IAccessorPropertyMapper accessorMapper, HbmMap mapping, HbmMapping mapDoc) { if (ownerType == null) { throw new ArgumentNullException("ownerType"); } if (keyType == null) { throw new ArgumentNullException("keyType"); } if (valueType == null) { throw new ArgumentNullException("valueType"); } if (mapping == null) { throw new ArgumentNullException("mapping"); } OwnerType = ownerType; KeyType = keyType; ValueType = valueType; this.mapping = mapping; this.mapDoc = mapDoc; if (mapping.Key == null) { mapping.key = new HbmKey(); } keyMapper = new KeyMapper(ownerType, mapping.Key); if (KeyType.IsValueType || KeyType == typeof(string)) { mapping.Item = new HbmMapKey { type = KeyType.GetNhTypeName() }; } else { mapping.Item = new HbmMapKeyManyToMany { @class = KeyType.GetShortClassName(mapDoc) }; } entityPropertyMapper = accessorMapper; }
public JoinMapper(System.Type container, string splitGroupId, HbmJoin hbmJoin, HbmMapping mapDoc) : base(container, mapDoc) { if (splitGroupId == null) { throw new ArgumentNullException("splitGroupId"); } if (hbmJoin == null) { throw new ArgumentNullException("hbmJoin"); } this.hbmJoin = hbmJoin; this.hbmJoin.table = splitGroupId.Trim(); if (string.IsNullOrEmpty(this.hbmJoin.table)) { throw new ArgumentOutOfRangeException("splitGroupId", "The table-name cant be empty."); } if (hbmJoin.key == null) { hbmJoin.key = new HbmKey { column1 = container.Name.ToLowerInvariant() + "_key" }; } keyMapper = new KeyMapper(container, hbmJoin.key); }