Hi,

I am trying to use Jakob Andersen's URI custom UserType in my
application:
http://intellect.dk/post/Implementing-custom-types-in-nHibernate.aspx

I have read these two posts:
http://wiki.fluentnhibernate.org/show/AutoMappingTypeConventions
http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/aad03ed43397ce27/506a0b32e80974ae?lnk=gst&q=IUserType#506a0b32e80974ae

Yet, I cannot get this to work. I don't need the Url to map to a
specific column in a specific table. I just want the Automapper to
decipher all Url types to Db.String type whenever it sees property
names that match in the model and DB table. According to the Wiki
pages, I shouldn't even have to override the UserTypeConvention<Url>?
I did just for completeness.

I have:
namespace MyProject.Core.CustomTypes { public class Url :
IUserType ... }

namespace MyProject.Data.NHibernateMaps.Conventions
{
    public class UrlTypeConvention : UserTypeConvention<Url>
    {
        public override void Apply(IProperty target)
        {
            base.Apply(target);
        }
    }
}

private Action<IConventionFinder> GetConventions()
{
    return c =>
    {
        c.Add<PrimaryKeyConvention>();
        ...
        c.Add<UrlTypeConvention>();
    };
}

public class Contact : IEntityWithTypeId<Guid>
{
    ...
    public virtual Url PictureUrl { get; set; } // DB column has the
same name
    ...
}

But everytime I run my test to confirm the DB matches the mappings,
the tests fail to run because the project can't initialize, with the
error:
An association from the table Contacts refers to an unmapped class:
MyProject.Core.CustomTypes.Url

I can fix this by creating a mapping override for my Contact entity,
but this seems cumbersome.

Any ideas what I'm doing wrong?

Cheers,
- Chris
--~--~---------~--~----~------------~-------~--~----~
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