C# Class PetStore.Service.DataAccess.AR.ARProductDataAccess

ActiveRecord implementation of a data access class for the Product entity.
Inheritance: IProductDataAccess
显示文件 Open project: nats/castle-1.0.3-mono

Public Methods

Method Description
ARProductDataAccess ( ISessionFactory sessionFactory ) : System

As you probably know the ISessionFactory is a NHibernate interface. As we're using ActiveRecord integration facility its implementation (at least the one we will get here) is provided by the facility and the only method available is OpenSession(). This allow the facility to provide automatic transaction management and others goodies.

Find ( int productId ) : Product
FindAll ( ) : PetStore.Model.Product[]
FindByCategory ( int category ) : PetStore.Model.Product[]
GetProductIds ( ) : int[]

We need to return only the ids here, and there are a bunch of options. We choose to use a NH query through ActiveRecord

Method Details

ARProductDataAccess() public method

As you probably know the ISessionFactory is a NHibernate interface. As we're using ActiveRecord integration facility its implementation (at least the one we will get here) is provided by the facility and the only method available is OpenSession(). This allow the facility to provide automatic transaction management and others goodies.
public ARProductDataAccess ( ISessionFactory sessionFactory ) : System
sessionFactory ISessionFactory
return System

Find() public method

public Find ( int productId ) : Product
productId int
return PetStore.Model.Product

FindAll() public method

public FindAll ( ) : PetStore.Model.Product[]
return PetStore.Model.Product[]

FindByCategory() public method

public FindByCategory ( int category ) : PetStore.Model.Product[]
category int
return PetStore.Model.Product[]

GetProductIds() public method

We need to return only the ids here, and there are a bunch of options. We choose to use a NH query through ActiveRecord
public GetProductIds ( ) : int[]
return int[]