Пример #1
0
        public void Start(string prefix, MappedPropertyInfo item)
        {
            HbmSet              set       = item.HbmObject <HbmSet>();
            MappedPropertyInfo  childItem = new MappedPropertyInfo(set.Item, item.FileName);
            PropertyMappingType subType   = childItem.Type;

            if (subType == PropertyMappingType.ManyToMany)
            {
                _builder.StartMethod(prefix, string.Format("{0}<{1}>(x => x.{2})", FluentNHibernateNames.HasManyToMany, item.ReturnType, item.Name));
                _builder.AddLine(string.Format(".{0}(\"{1}\")", KeyColumn.FluentNHibernateNames.ChildKeyColumn, childItem.ColumnName));
            }
            else if (subType == PropertyMappingType.OneToMany)
            {
                _builder.StartMethod(prefix, string.Format("{0}<{1}>(x => x.{2})", FluentNHibernateNames.HasMany, item.ReturnType, item.Name));
            }
            else
            {
                _builder.StartMethod(prefix, "set?(x => x" + item.Name + ")");
            }
            _builder.AddLine(string.Format(".{0}()", FluentNHibernateNames.AsSet));
            _keyColumn.Add(set.inverse, item.ColumnName, subType);
            _lazyLoad.Add(set.lazySpecified, set.lazy);
            _table.Add(set.table);
            _inverse.Add(set.inverse);
            _cascade.Add(set.cascade);
            _fetch.Add(set.fetch);
            _orderBy.Add(set.orderby);
            _where.Add(set.where);
            _cacheBuilder.Add(set.cache);
        }
Пример #2
0
 public void Add(bool isInverse, string columnName, PropertyMappingType type)
 {
     if (type == PropertyMappingType.ManyToMany)
     {
         if (isInverse)
         {
             _builder.AddLine(string.Format(".{0}(\"{1}\")", FluentNHibernateNames.ChildKeyColumn, columnName));
         }
         else
         {
             _builder.AddLine(string.Format(".{0}(\"{1}\")", FluentNHibernateNames.ParentKeyColumn, columnName));
         }
     }
     else if (type == PropertyMappingType.OneToMany)
     {
         _builder.AddLine(string.Format(".{0}(\"{1}\")", FluentNHibernateNames.KeyColumn, columnName));
     }
 }
Пример #3
0
 public void Add(bool isInverse, string columnName, PropertyMappingType type)
 {
     if (type == PropertyMappingType.ManyToMany)
     {
         if (isInverse)
         {
             _builder.AddLine(string.Format(".{0}(\"{1}\")", FluentNHibernateNames.ChildKeyColumn, columnName));
         }
         else
         {
             _builder.AddLine(string.Format(".{0}(\"{1}\")", FluentNHibernateNames.ParentKeyColumn, columnName));
         }
     }
     else if (type == PropertyMappingType.OneToMany)
     {
         _builder.AddLine(string.Format(".{0}(\"{1}\")", FluentNHibernateNames.KeyColumn, columnName));
     }
 }
Пример #4
0
 /// <summary>
 /// Create a new property hint
 /// </summary>
 /// <param name="propertyMappingType">The type of property mapping</param>
 /// <param name="schemaTypeUri">OPTIONAL: The URI of the RDF property type mapped</param>
 public PropertyHint(PropertyMappingType propertyMappingType, string schemaTypeUri = null)
 {
     MappingType   = propertyMappingType;
     SchemaTypeUri = schemaTypeUri;
 }
Пример #5
0
 /// <summary>
 /// Create a new property hint
 /// </summary>
 /// <param name="propertyMappingType">The type of property mapping</param>
 /// <param name="schemaTypeUri">OPTIONAL: The URI of the RDF property type mapped</param>
 public PropertyHint(PropertyMappingType propertyMappingType, string schemaTypeUri = null)
 {
     MappingType = propertyMappingType;
     SchemaTypeUri = schemaTypeUri;
 }
Пример #6
0
 public PropertyMapping(PropertyMappingType propertyMappingType, string coreInterfaceId = null)
 {
     CoreInterfaceId     = coreInterfaceId;
     PropertyMappingType = propertyMappingType;
 }