1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace PetStore
.Service
22 /// This service doesn't add much, as a matter of fact
23 /// we're being extremely purists here and
24 /// the service just sits between the presentation layer
25 /// and the data access layer. We, for this project, don't
26 /// want the presentation layer using the data access layer
27 /// directly. But, as I said, we're just being purists.
29 public class DefaultProductService
: IProductService
31 private readonly IProductDataAccess productDataAccess
;
33 public DefaultProductService(IProductDataAccess productDataAccess
)
35 this.productDataAccess
= productDataAccess
;
38 public Product
Find(int productId
)
40 return productDataAccess
.Find(productId
);
43 public Product
[] FindAll()
45 return productDataAccess
.FindAll();
48 public Product
[] FindByCategory(int categoryId
)
50 return productDataAccess
.FindByCategory(categoryId
);