Design Pattern Framework 3.5
Product Class
Patterns-In-Action! Application ► BusinessObjects ► Product
Class that holds product information.
Declaration Syntax
C# | Visual Basic |
public class Product : BusinessObject
Public Class Product _ Inherits BusinessObject
Members
All Members | Constructors | Methods | Properties | ||
|
|
|
Icon | Member | Description |
---|---|---|
Product()()() |
Default constructor for product.
|
|
Product(Int32, String, String, Double, Int32) |
Overloaded constructor for product
|
|
AddRule(BusinessRule) |
Adds a business rule to the business object.
(Inherited from BusinessObject.) |
|
Category |
Gets or sets the product category under which product is categorized.
|
|
Equals(Object) | (Inherited from Object.) |
|
Finalize()()() |
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.) |
|
GetHashCode()()() |
Serves as a hash function for a particular type.
(Inherited from Object.) |
|
GetType()()() |
Gets the Type of the current instance.
(Inherited from Object.) |
|
MemberwiseClone()()() |
Creates a shallow copy of the current Object.
(Inherited from Object.) |
|
ProductId |
Gets or sets the unique identifier for the product.
The Identity Field Design Pattern.
|
|
ProductName |
Gets or sets the product name.
|
|
ToString()()() | (Inherited from Object.) |
|
UnitPrice |
Gets or sets the unit price of the product in US$.
|
|
UnitsInStock |
Gets or sets units in stock for the product.
|
|
Validate()()() |
Determines whether business rules are valid or not.
Creates a list of validation errors when appropriate.
(Inherited from BusinessObject.) |
|
ValidationErrors |
Gets list of validations errors.
(Inherited from BusinessObject.) |
|
Version |
Gets or sets version. Used in support of optimistic concurrency.
|
|
Weight |
Gets or sets the weight of the product.
|
Remarks
Enterprise Design Pattern: Domain Model, Identity Field.
This is where your business logic resides. In this example there are none.
Another place for business logic and business rules is in the Facade.
For an example see CustomerFacade in the Facade layer.
The Domain Model Design Pattern states that domain objects incorporate
both behavior and data. Behavior may include simple or complex business logic.
The Identity Field Design Pattern saves the ID field in an object to maintain
identity between an in-memory business object and that database rows.
Inheritance Hierarchy
Object | ||
BusinessObject | ||
Product |