Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in
K
K13 .Net Core Xperience Adapter
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • Operations
    • Operations
    • Metrics
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • Administrator
  • K13 .Net Core Xperience Adapter
  • Wiki
  • Usage Guidelines

Usage Guidelines · Changes

Page history
Create Usage Guidelines authored Jun 27, 2022 by eugene's avatar eugene
Hide whitespace changes
Inline Side-by-side
Showing with 35 additions and 0 deletions
+35 -0
  • Usage-Guidelines.md Usage-Guidelines.md +35 -0
  • No files found.
Usage-Guidelines.md 0 → 100644
View page @ aae78656
**appsettings.json**
- Do no store sensitive information, especially passwords in appsettings.json, use the Secret Manager. Please see [Safe storage of app secrets in development in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&tabs=windows) for reference.
**Models**
- Store all business class data models under **\<ProjectName\>.Business/Models**
- Store all Kentico generated classes under **\<ProjectNam\e>.Business/Models/Generated**. No need to create subfolders unless the number of models is greater than 20, then logically group them in subfolders.
- No need to add Dto in the class name, example **HomePage**, not ***HomePageDto***
- Name the model class the same as the Kentico Generated class, you just have a different namespace
- Kentico Generated Class: **CMS.DocumentEngine.Types.\<ProjectName\>.HomePage**
- Business Model Class: **\<ProjectName\>.Business.Models.HomePage**
**Repositories**
- Store all repositories under **\<ProjectName\>.Business/Repositories**. No need to create subfolders unless the number of repositories is greater than 20, then logically group them in subfolders.
- Always inherit from **XperienceAdapter.Repositories.BasePageRepository\<\<BusinessClass\>, \<GeneratedClass\>\>**
- `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.
```
public interface IHomePageRepository
{
public HomePage GetHomePage();
}
public class HomePageRepository : BasePageRepository<HomePage, CMS.DocumentEngine.Types.<ProjectName>.HomePage>, IHomePageRepository
{
public HomePage GetHomePage()
{
....
}
}
```
** 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
Clone repository
  • Package Releases
  • Usage Guidelines