O'Reilly logo

NHibernate 3 Beginner's Guide by Gabriel N. Schenker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – Creating a Name value object

We want to create the implementation for a simple value object, we shall do so in the following example.

  1. In Visual Studio, create a new project. Select Class Library as the template and call this project OrderingSystem.
  2. Remove the class Class1.cs, that has been added by default, from the project.
  3. Add a folder called Domain to the project.
  4. Add a new class to the folder Domain of the project; call this class Name. As shown in the following code snippet:
    namespace OrderingSystem.Domain
    {
      public class Name
      { }
    }
  5. Add an auto-property LastName of type string to the class. Define the setter to be private, as shown in the following line of code:
    public string LastName { get; private set; }
  6. Add another auto-property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required