NHibernate (or another ORM recommendation), a real life example?

I would like to study database applications in C #, and I'm going to select some structure. I have heard many NHibernate recommendations, however I have not decided yet.

In any case, I would like to know if there is any real example (with sources) of NHibernate in C # to learn the best practices, etc.? I know that all of them are probably described in the documents, but a working example helps to understand the correct development structure.

+6
c # database orm nhibernate
source share
6 answers

Check out Ayende @Rahien , there are many blog entries on NHibernate. Another good source is NHibernate Forge . This will be especially helpful to get started: NHibernate Getting Started Guide . Finally, here you can find a downloadable working example of the NHibernate project based on the Northwind database.

+5
source share

The open source project S # arp Architecture is still the best example I know for NHibernate:

Even if it is sometimes overestimated, it follows best practices for implementing NHibernate in a layered architecture.

I personally learned a lot about ORM and good loosely coupled architecture project code.

Another useful article about NHibernate can be found in CodeProject:

+4
source share

Real life example: Orchard uses NHibernate, Fluent NHibernate, and Linq To NHibernate to access data. This is an open source CMS build from Microsofties . Source code is available in CodePlex .

+2
source share

NHibernate is a very robust ORM that allows you to create POCO classes, keeping your domain model very clean and allowing for easier testing.

Entity Framework is developing rapidly. The user interface tools in EF4 are suitable for small applications, but it is difficult to manage such developments with version control, a rapidly changing database schema, etc. With EF4 Code First (at the CTP stage at the moment) EF4 will be much more attractive.

I have used LLBLGen in the past with great success.

For beginners, Webmatrix can start working really fast. Check out Rob Connery's video on how to use it as part of the testing here.

+1
source share

As others have said, NHibernate is a solid foundation to work with. It is quite mature and has many features that allow you to precisely control what will happen to your date.

If you are just starting out with database programming, you can also consider LinqToSql . It is not as strong as NHibernate, and was more or less EOL ed. However, what you throw in power, you get in simplicity. This will allow you to get the basic database application and run, probably within minutes, and let you experiment when you first find out. Despite the ease of launching your first application and its operation, it is still powerful enough to be used to create something like Stack Overflow .

Some good Linq to Sql source resources:

  • Nerddinner
  • ScottGu Series: Using LINQ to SQL (link to part 9 because it has links 1 through 8 at the top). Although it does not have an application download (I can best say), it basically guides you through building the application.

If you are looking to learn about NHibernate, you can also start with the NerdDinner tutorial above and take a look at Ayende's entry by placing it in NHibernate, as well as a series on mapping NerdDinner with NHibernate. There is also a series of articles about using NHibernate in a WPF application (most of the other guides focus on web applications).

Resources

One thing that I canโ€™t stress enough is when you go through the initial phase of โ€œcool ... I can talk to the databaseโ€, take a trial license for the corresponding profiler (list of profilers at the top) for your platform. This will allow you to see what exactly your ORM sends to the database. This can be very useful for learning how what you do is converted to SQL and also eliminates the errors you encounter.

No matter which path you choose, you should also take a look at Microsoft.Net Data Access Practices: A Fun Comparison and Developing GPS Data: A Guide for Choosing the Right Data Access Technology for Your Application Today . Although These Technologies cover only Microsoft technologies, this will give you a high-level overview of what is available there, and when it may not be suitable for your projects (in the future).

+1
source share

Take a look at the NHibernate addins project http://code.google.com/p/unhaddins/

Although this is not an example of real life, application examples there are pretty close to real applications | scripts. The examples there are written by well-known and respected programmers, and they show some serious OOP skills and design patterns. This is definitely not for beginners.

0
source share

All Articles