Search code examples
c#nhibernatecastle-activerecord

What is the flow of nhibernate Pure?


I want to know the flow of NHibernate pure c#. What is the difference of castle active record and NHibernate pure?

Kindly teach me if there is someone who know well about them.


Solution

  • I assume pure means without Castle or Fluent.

    There is much to explain which cannot be covered in this answer so I will just note the steps.

    • Create Entity (POCO) classes based on your database structure.
    • Create mapping (.hbm.xml) files based on your Entity classes and database structure. To avoid mapping files, you can choose Fluent way which is other topic for discussion.
    • Decide the location for configuration (web.config/app.config/code) and do the necessary configurations.
    • Write CRUD methods in your DAL using various (Linq/Query/Criteria/QueryOver/HQL) ways available.
    • Call BuildSessionFactory at startup of application.
    • Call DAL methods.

    NHibernate documentation is good source of information.

    This article1 and article2 should be good starting point for you.

    For Castle, I suggest you ask separate question.