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 Customer entity

Now, let's implement a real entity that inherits from the base entity. Here we can focus fully on the properties that describe the entity and on the methods that describe the entity's behavior.

  1. Add a new class to the folder Domain of the project and call this class Customer.
  2. Make the Customer entity inherit from the Entity base class.
    public class Customer : Entity<Customer>
    { }
  3. In the class Customer, implement the following auto-properties: CustomerIdentifier of type string and CustomerName of type Name. Make the setters of the properties private, as shown in the following code snippet:
    public string CustomerIdentifier { get; private set; }
    public Name CustomerName { get; private set; }
  4. Implement a method ...

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