My Entity Class: public class Building { /// /// internal Id /// public virtual long Id { get; set; } .............. }
My Mapping:
var model = AutoMap.AssemblyOf() .Setup(s => s.FindIdentity = p => p.Name == "Id") .Where(t => t.Namespace == "SpikeAutoMappings");
var database = Fluently.Configure() .Database(DatabaseConfigurer) .Mappings(m=>m.AutoMappings.Add(model));
Need somebody to see what is wrong coz I keep having this error when run unit test: Initialization method TestProject1.MappingTestBase.TestInitialize threw exception. FluentNHibernate.Cfg.FluentConfigurationException: FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
---> FluentNHibernate.Visitors.ValidationException: The entity doesn't have an Id mapped. Use the Id method to map your identity property. For example: Id(x => x.Id)..