using NHibernate.Mapping.ByCode; using NHibernate.Mapping.ByCode.Conformist; public class EmployeeMap : ClassMapping{ public EmployeeMap() { Id(x => x.Id, m => m.Generator(Generators.Identity)); Property(x => x.Name); Property(x => x.Email); Property(x => x.Age); Table("Employee"); } }
using NHibernate.Mapping.ByCode; using NHibernate.Mapping.ByCode.Conformist; public class CustomerMap : ClassMappingThis code example maps a Customer class to the Customers table in a database using NHibernate. It defines the properties of the Customer class and how they are mapped to the database table. Package library: NHibernate.Mapping.{ public CustomerMap() { Table("Customers"); Id(x => x.Id, m => m.Generator(Generators.Guid)); Property(x => x.Name); Property(x => x.Address); Property(x => x.City); Property(x => x.State); Property(x => x.ZipCode); } }