It is weird ... I posted this message like 8 hours ago and it just now
showed up.  I figured I had posted it wrong.

I got it working.  I'm not sure of the exact syntax but its something
like:

Map(v => v.Name).CustomTypeIs<TrimmedString>().ColumnNames.Add
("VNAME");

That felt like a pretty oh duh moment.  Just add an s and it works :)

I'll check when I'm at my code again, but I think ColumnName() returns
a void or something that can't be chained.

So far FNH has handled what I've thrown at it minus one thing:
Composite ID with custom user types:

//from memory.... probably wrong
UseCompositeID()
.WithKeyProperty(x => x.Number, "ORDNO").SetAttribute("type", typeof
(RightJustifiedString).AssemblyQualifiedName)
.WithKeyProperty(x => x.Item, "ITNBR").SetAttribute("type", typeof
(TrimmedString).AssemblyQualifiedName)

I looked at the code on google code (I attempted to download with
Tortoise SVN and failed... but thats probably me being dumb... I'm an
SVN idiot) and SetAttribute is marked as not implemented... which
makes sense why this fails.  It looks like it would be really easy to
add another WithKeyProperty overload including the type as a
parameter, but I'm not sure if that is too much of a hack and getting
SetAttribute working is a better idea.  I don't really remember how
many attributes you can set on key-property though.

Anyways, thanks for the cool program.  I really enjoy it so far,
mostly because my code is full of custom types and I hate having to
update mapping files when I move them to a new assembly on a new
project :p

On May 21, 2:27 pm, Hudson Akridge <[email protected]> wrote:
> Just reverse the order of which you call the method chain for now, so
> CustomTypeIs<T>() would be last. That way you don't have to worry about
> chaining issues. This is a common problem found in other places that we're
> looking to standardize and resolve here soon at some point whenever we can
> get the time to fully convert to the SM and use a true DSL abstraction for
> the Fluent Interface.
>
> On Thu, May 21, 2009 at 9:18 AM, Huey <[email protected]> wrote:
>
> > Hello.
>
> > I have a property mapping:
>
> > Map(v => v.Name).CustomTypeIs<TrimmedString>().ColumnName("VNAME");
>
> > This doesn't work.  CustomTypeIs<TrimmedString>() breaks the chain so
> > ColumnName is unrecognized:
>
> > "FluentNHibernate.Mapping.IProperty" does not contain a definition for
> > 'ColumnName'.
>
> > Am I missing a using statement?  All I have us: using
> > FluentNHibernate.Mapping.  Full Map is:
>
> >    public class VendorMap : ClassMap<Vendor>
> >    {
> >        public VendorMap()
> >        {
> >            Id(v => v.Code).GeneratedBy.Assigned().ColumnName
> > ("VNDNR");
> >            Map(v => v.Name).CustomTypeIs<TrimmedString>().ColumnName
> > ("VNAME");
> >        }
> >    }
>
> > TrimmedString is IUserType (it just returns the string.trim() of the
> > result so I don't have a lot of whitespace).
>
> > I'm using Fluent NHibernate v2.0.50727.  It was the binary download
> > from r523.
>
> > I actually have the same issue for Id(v = v.Code) and CustomTypeIs<>()
> > but Id won't let CustomTypeIs no matter what -- it isn't an option.
> > The NHibernate mapping I'm trying to replicate is:
>
> > <?xml version="1.0" encoding="utf-8" ?>
> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> > assembly="ConsoleApplication11" namespace="ConsoleApplication11">
> >  <class name="Vendor" table="VENNAM">
> >    <id name="Code" column="VNDNR"
> > type="ConsoleApplication11.TrimmedString, ConsoleApplication11">
> >      <generator class="assigned" />
> >    </id>
> >    <property name="Name" column="VNAME"
> > type="ConsoleApplication11.TrimmedString, ConsoleApplication11"/>
> >  </class>
> > </hibernate-mapping>
>
> > This is my first attempt at using FNH so I could be doing something
> > dumb.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to