We have this hibernate.cfg.xml file. Is there a way to tell Hibernate to just scan a directory instead of having to add an entry here for each class?
A NHibernate best practice is to add only an assembly to the configuration before building your ISessionFactory API.
Robert did point it out with the element.
Another way would be to perform runtime configuration as follows:
Configuration cfg = new Configuration();
cfg.AddAssembly(typeof(OneOfYourDomainType).Assembly.Name); // Or something like that by memory.
cfg.Configure();
static ISessionFactory sessionFactory = cfg.BuildSessionFactory();
Making the ISessionFactory static is important as it is very expensive to instantiate.
typeof(OneOfYourDomainType).Assembly.Name returns the name of your assembly containing all of your domain objects, with the proper mappings. Then, adding this, you add the assembly, and you do not need to repeat the process again and again for your domain types.