That error message is confusing. Aren't the two types listed exactly the
same?

On Fri, Dec 12, 2008 at 5:42 AM, Bobby Johnson <[email protected]>wrote:

> I think I got this one figured out with the following mapping of User:
>
> public class UserMap : ClassMap<User>
>     {
>         public UserMap()
>         {
>             WithTable("oxite_User");
>             Id(x => x.ID,
> "UserID").GeneratedBy.Guid().WithUnsavedValue(null);
>             Map(x => x.Username).WithLengthOf(256).CanNotBeNull();
>             Map(x => x.DisplayName).WithLengthOf(256).CanNotBeNull();
>             Map(x => x.Email).WithLengthOf(256).CanNotBeNull();
>             Map(x => x.HashedEmail).WithLengthOf(100).CanNotBeNull();
>             Map(x => x.Password).WithLengthOf(128).CanNotBeNull();
>             Map(x => x.PasswordSalt).WithLengthOf(128).CanNotBeNull();
>             Map(x => x.Status).CanNotBeNull();
>             References(x => (Language) x.LanguageDefault,
> "DefaultLanuageID")
>                 .Access.AsCamelCaseField();
>         }
>     }
>
> But my PersistenceSpecification test fails with the following error:
>
> [Test]
>         public void Can_Add_User_To_Database()
>         {
>             new PersistenceSpecification<User>(Session)
>                 .CheckProperty(x => x.Username, "UserName")
>                 .CheckProperty(x => x.DisplayName, "DisplayName")
>                 .CheckProperty(x => x.Email, "Email")
>                 .CheckProperty(x => x.HashedEmail, "HashedEmail")
>                 .CheckProperty(x => x.Password, "Password")
>                 .CheckProperty(x => x.PasswordSalt, "PasswordSalt")
>                 .CheckProperty(x => x.Status, new byte())
>                 .CheckReference(x => x.LanguageDefault,
>                                (ILanguage) new Language
>                                     {
>                                         Name = "Name",
>                                         DisplayName = "DisplayName"
>                                     })
>                 .VerifyTheMappings();
>         }
>
>
> 'NotMyself.Oxite.Data.LinqToNHibernateProvider.Entities.Language' but got 
> 'NotMyself.Oxite.Data.LinqToNHibernateProvider.Entities.Language' for 
> Property 'LanguageDefault'
>
>
> On Thu, Dec 11, 2008 at 9:56 AM, Bobby Johnson <[email protected]>wrote:
>
>> I ran into an interesting problem last night and wanted to get some input
>> on how to tackle mapping it.
>>
>> Given the relationship between User and Language in this set of classes,
>> how would you go about mapping User.LanguageDefault?
>>
>> http://pastie.org/336481
>>
>> Note that the property LanguageDefault returns ILanguage but the private
>> field is of type Language.
>>
>> --
>> "The explanation requiring the fewest assumptions is most likely to be
>> correct."
>>
>> - Occam's Razor
>> http://en.wikipedia.org/wiki/Occam's_Razor<http://en.wikipedia.org/wiki/Occam%27s_Razor>
>>
>
>
>
> --
> "The explanation requiring the fewest assumptions is most likely to be
> correct."
>
> - Occam's Razor
> http://en.wikipedia.org/wiki/Occam's_Razor<http://en.wikipedia.org/wiki/Occam%27s_Razor>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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