... | ... | @@ -15,7 +15,7 @@ |
|
|
- `public class HomePageRepository : BasePageRepository<HomePage, CMS.DocumentEngine.Types.<ProjectName>.HomePage>`
|
|
|
- If custom methods are needed to simplify data access to repositories, create an interface for the repository and have the repository inherit from both the interface and BasePageRepository.
|
|
|
|
|
|
```
|
|
|
```csharp
|
|
|
public interface IHomePageRepository
|
|
|
{
|
|
|
public HomePage GetHomePage();
|
... | ... | @@ -30,6 +30,11 @@ |
|
|
}
|
|
|
```
|
|
|
|
|
|
**Navigation**
|
|
|
- Basic Navigation - Register `NavigationRepository<NavigationItem>` as `INavigationRepository<NavigationItem>` in the dependency injection container, e.g. AutoFac
|
|
|
- CustomNavigation - Create a custom NavigationItem DTO and repository. See sample implementations for [TestMenuPageDto](https://gitlab.raybiztech.com/root/k13-.net-core-xperience-adapter/-/blob/master/XperienceAdapter.Tests/Repositories/TestMenuPageDto.cs) and [TestMenuPageRepository](https://gitlab.raybiztech.com/root/k13-.net-core-xperience-adapter/-/blob/master/XperienceAdapter.Tests/Repositories/TestMenuPageRepository.cs). You can then register `NavigationRepository<TestMenuPageDto>` as `NavigationRepository<TestMenuPageDto>` in the dependency injection container.
|
|
|
|
|
|
|
|
|
**Unit Testing**
|
|
|
- Create unit tests for all repositories with custom methods, otherwise, not needed
|
|
|
- Create unit tests for all components, mock repositories if retrieving data for the component |