After reading some articles on Fluent NHibernate, I was embarrassed about where to start.
I have an existing database for which I need to create a DataAccessLayer. I am new to NHibernate and FluentNhibernate. Since I realized that there was no need to write hbm.xml files, I chose Fluent Nhibernate.
So what is FluentMapping? and AutoMapping?
I created a LibProProject class named FirstProject.Entities
I created a class called "Client"
namespace FirstProject.Entities { public class Customer { public virtual int CustomerID { get; set; } public virtual string CustomerName { get; set; } public virtual string Address1 { get; set; } public virtual string Address2 { get; set; } public virtual string City { get; set; } public virtual string State { get; set; } public virtual int Zip { get; set; } } }
Then I created a mapping class
namespace FirstProject.Entities { public class CusotmerMap : ClassMap<Customer> { public CustomerMap() { Id(x => x.CustomerID).Column("CustomerID").GeneratedBy.Assigned(); Map(x => x.CustomerName); Map(x => x.Address1); Map(x => x.Address2); Map(x => x.City); Map(x => x.Zip); } } }
Now I do not know how to move on. I am doing it right. Please suggest
how to set up and continue next
source share