Incorrect NHibernate Display

I see the following error on my Fluent NHibernate card:

NHibernate.MappingException: Association references unmapped class: System.Guid

I swear I did it before, and it worked, so I'm not sure what causes the problem. I am using FNH 1.1 with a SQLite database. Here is my class and map:

 public class Photo { public virtual Guid Id { get; set; } public virtual byte[] Data { get; set; } public virtual string Caption { get; set; } } public class PhotoMap : ClassMap<Photo> { public PhotoMap() { Id(p => p.Id).GeneratedBy.Guid(); Map(p => p.Caption); Map(p => p.Data); } } 

Thanks for the help.

+4
source share
1 answer

Try not to use the GUID as the primary key of the entity. It does not scale well (the GUID is not a sortable type), which can lead to fragmentation of the high index in your database.

Otherwise, see The Problem of Using Nhibernate and Guids / UniqueIdentifiers Free Autodial as Primary Key Fields - this notes that version 1.0 of FluentNH has error identifiers related to error identifiers and suggests using the SVN trunk.

+5
source

Source: https://habr.com/ru/post/1339685/


All Articles