Fluent Nhibernate Mapping for Sql Views
Views are mapped the same way tables are mapped except that you should put Readonly()
in the mapping to prevent accidently writing to it. Example:
public class FeaturedCompanyMap : ClassMap<FeaturedCompany>
{
public FeaturedCompanyMap ()
{
Table("FeaturedCompanies");
ReadOnly();
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.Count);
}
}