Problem with Property.WithLengthOf

14 views
Skip to first unread message

Martin Nilsson

unread,
Feb 22, 2009, 3:03:55 PM2/22/09
to fluent-n...@googlegroups.com
More info in this thread because I thought it was a problem in NH
http://groups.google.com/group/nhusers/browse_thread/thread/81e8cffa5a0a0fb4

Class:
public class Entity
{
  public virtual Guid Id { get; set; }
  public virtual string Content { get; set; }

}

Mapping:
public EntityMap()
{
  Id(x => x.Id);
  Map(x => x.Content).WithLengthOf(2500);
}

Generates this part in the hbm:
<property name="Content" length="*2500*" type="String">
  <column name="Content" />
</property>

And when I run SchemaExport.Create it looks at column and it has no length defined so length of column in table != 2500

You can also check this test in Fluent
PropertyMapTester.Map_WithFluentLength_OnString_UsesWithLengthOf_PropertyColumnAttribute:
ClassElement.innerXml == "<property name=\"Name\" length=\"20\" type=\"String\"><column name=\"Name\" /></property>"

Steven Lyons

unread,
Feb 23, 2009, 1:10:59 PM2/23/09
to Fluent NHibernate
Martin,

This is a problem that is known. If you want to fix it in your source
until it gets fixed, you can find a patch I made in this message:
http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/37167c7aae6d03a5

Hope it works for you,
s.


On Feb 22, 3:03 pm, Martin Nilsson <mffmar...@gmail.com> wrote:
> More info in this thread because I thought it was a problem in NHhttp://groups.google.com/group/nhusers/browse_thread/thread/81e8cffa5...
>
> Class:
> public class Entity
> {
>   public virtual Guid Id { get; set; }
>   public virtual string Content { get; set; }
>
> }
>
> Mapping:
> public EntityMap()
> {
>   Id(x => x.Id);
>   Map(x => x.Content).WithLengthOf(2500);
>
> }
>
> Generates this part in the hbm:
> <property name="Content" length="*2500*" type="String">
>   <column name="Content" />
> </property>
>
> And when I run SchemaExport.Create it looks at *column *and it has no length

Martin Nilsson

unread,
Feb 23, 2009, 1:33:57 PM2/23/09
to fluent-n...@googlegroups.com
Thanks!
But I couldn't find the patch to apply for this fix.

Steven Lyons

unread,
Feb 23, 2009, 1:59:17 PM2/23/09
to Fluent NHibernate
I can't attach files to the messages on this forum, so it's just
inline in the last message of the thread. You can just copy the text
into a .patch file and apply it to your working copy.


On Feb 23, 1:33 pm, Martin Nilsson <mffmar...@gmail.com> wrote:
> Thanks!
> But I couldn't find the patch to apply for this fix.
>
> On Mon, Feb 23, 2009 at 7:10 PM, Steven Lyons <stevenly...@gmail.com> wrote:
>
> > Martin,
>
> > This is a problem that is known. If you want to fix it in your source
> > until it gets fixed, you can find a patch I made in this message:
>
> >http://groups.google.com/group/fluent-nhibernate/browse_thread/thread...

James Gregory

unread,
Feb 23, 2009, 4:53:32 PM2/23/09
to fluent-n...@googlegroups.com
This is fixed now, as of 2 minutes ago. Stupid bug.

Martin Nilsson

unread,
Feb 23, 2009, 4:55:08 PM2/23/09
to fluent-n...@googlegroups.com
Great! :)
Thanks for the great work btw!
Reply all
Reply to author
Forward
0 new messages