Can anybody confirm that the issue exists? The inability to write correctly positioned custom mapping part limits fluent-nhibernate users to rather restricted subset of nhibernate features (or makes them using xml mapping files directly).
Is there any sort of bug-tracking system to submit fluent-nhibernate bugs? On 23 июл, 13:13, Alexander Kovtik <[email protected]> wrote: > Any ideas how to write custom mapping part after all properties? > > On 22 июл, 14:49, Alexander Kovtik <[email protected]> wrote: > > > > > MappingPartComparer works fine, the problem is that the sorted > > collection (ClassMapping.UnmigratedParts) does not include all mapping > > parts of the class. I don't know how to attach the file to discussion, > > so I will post here all the files from sample console application. I > > am using revision 541 of the fluent-nhibernate. > > > App.config > > <configuration> > > <configSections> > > <section name="hibernate-configuration" > > type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/> > > </configSections> > > <connectionStrings> > > <add name="Database" > > connectionString="Server=localhost;Database=NHibernateTest;Integrated > > Security=true"/> > > </connectionStrings> > > <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> > > <session-factory> > > <property > > name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, > > NHibernate.ByteCode.Castle</property> > > <property > > name="dialect">NHibernate.Dialect.MsSql2005Dialect</ > > property> > > <property > > name="connection.connection_string_name">Database</ > > property> > > <property name="hbm2ddl.auto">create</property> > > </session-factory> > > </hibernate-configuration> > > </configuration> > > > Program.cs > > public class Program > > { > > public static void Main() > > { > > var sessionFactory = Fluently.Configure() > > .Mappings(x => > > x.FluentMappings.AddFromAssemblyOf<Program> > > ().ExportTo(@"..\..\hbm")) > > .BuildSessionFactory(); > > } > > > } > > > User.cs > > public class User > > { > > public virtual int Id { get; set; } > > public virtual string Name { get; set; } > > > } > > > UserMap.cs > > public sealed class UserMap : ClassMap<User> > > { > > public UserMap() > > { > > this.Id(x => x.Id).GeneratedBy.Increment(); > > this.Map(x => x.Name); > > this.SetAttribute("where", "IsDeleted=0"); > > this.AddPart(new SqlDeletePart()); > > } > > > } > > > SqlDeletePart.cs > > public class SqlDeletePart : IMappingPart > > { > > public PartPosition PositionOnDocument > > { > > get { return PartPosition.Last; } > > } > > > public int LevelWithinPosition > > { > > get { return 10; } > > } > > > public void Write(XmlElement classElement, IMappingVisitor visitor) > > { > > var sqlDelete = classElement.AddElement("sql-delete"); > > sqlDelete.WithAtt("check", "rowcount"); > > sqlDelete.InnerText = String.Format("UPDATE {0} SET {1}=1 > > WHERE {1} > > =0", "[User]", "IsDeleted"); > > } > > > public void SetAttribute(string name, string value) > > { > > } > > > public void SetAttributes(Attributes attributes) > > { > > } > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
