Architecture Guidelines
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 20/100
- Issue 類型
- 文件
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 技術堆疊
- csharp
研究方向
先檢視 README 和 repository 中現有的程式碼撰寫指南文件,然後將它們與提議的 Project documentation、General Architecture 和 Web Application Architecture 區段進行比較。issue 未指明檔案,也未定義已達成共識的範圍;要視為完成,需要一套已接受且可執行的指南,以及明確的存放位置。
由索引模型根據 Issue 內容生成。
描述
Some proposals for guidelines based on things I've seen recently, and over the years:
Project documentation:
-
All projects should have a README file in their repository root that includes the following information, or contains links or instructions on where to find the following information:
- How to setup a local development environment for working on the project, including:
- Prerequisite installed software (IDEs, SDKs, Databases, other tooling, recommended IDE extensions, etc.), including version requirements.
- How to open the project in the recommended IDE/editor (e.g. "Open the .sln file in the repository root with Visual Studio 2019")
- How to build and run the project, including:
- How to restore any packages that aren't automatically restored. For example, Nuget packages are auto-restored by
dotnettooling, butnpmpackages are not. - How to obtain a local copy of any required database, if necessary.
- How to restore any packages that aren't automatically restored. For example, Nuget packages are auto-restored by
- How to run the project's tests
- How to contribute to the project's tests, including a brief summary of the different types of testing that are utilized in the application (unit testing, integration testing, UI testing, etc).
- How to contribute changes to the primary branch of the project, including a description of branching strategy, the project's pull request process & requirements, any review processes the project is subject to, including code reviews, architecture review, security reviews, etc.
- How the project is deployed, including:
- A description of each environment that the project may be deployed to
- Any URL(s) where the deployed/published project may be found
- A description of the process for promotion from one environment to another, including necessary approvals, manual testing/verification, and actual actions that must be taken to achieve the environment promotion (e.g. release pipelines).
- How to setup a local development environment for working on the project, including:
-
All possible sources of application configuration that is environment-dependent MUST be clearly enumerated in a README file in the root of the project's repository, or must otherwise be linked to from such a README file. This file MUST be updated when changes are made to how an application is configured.
- Possible sources of configuration include, but are not limited to:
- Injection by an automated build or release process
- Stored on a cloud service, such as Azure App Service configuration (injected into the app via Environment Variables), or Azure Key Vault
- Stored in database table(s)
- Stored in files checked into the repository, including appsettings.*.json, launchSettings.json, package.json, app.config, and any other file containing configuration.
- Stored from predefined files/directories in environments where the application is running.
- Hardcoded configuration (DO NOT use hardcoded configuration, but if it truly cannot be moved elsewhere, please document it.)
- Possible types of configuration include, but are not limited to:
- Any credentials, including username/password pairs and API keys
- Any configuration the instructs the application how to locate an external resource, including database connection strings, URLs, IP addresses, email addresses, cloud provider subscription IDs, resource IDs, or any other external resource.
- Possible sources of configuration include, but are not limited to:
General Architecture:
- Utilize Dependency Injection in all projects whenever possible This probably needs to be expanded upon - its maybe too open-ended and vague
- In projects utilizing dependency injection:
- DO NOT store global singletons in static fields/properties. Always resolve such objects from the DI container, including services, configuration, or any other singleton.
- DO NOT manually instantiate classes that are registered with the DI container. This is especially applicable to Entity Framework
DbContextinstances, because manual instantiation implies that theDbContextOptions<>are also being manually created, are hardcoded into theDbContextconstructor, or are being stored as a global singleton.- Exception: Instantiating
DbContextinstances during setup when the instance is being configured with some an in-memory provider.
- Exception: Instantiating
- AVOID using the service locator pattern, PREFER using the standard mechanisms of injection provided by your DI framework (e.g. constructor injection, ASP.NET Core parameter injection via
[FromServices], etc.)
Web Application Architecture:
- When an application needs to run long-running or recurring background jobs, you SHOULD prefer Hangfire (https://www.hangfire.io/) over homegrown out-of-process job engines, manual spawning of threads, using
Task.Run, or utilizing a cloud-native solution.- Exceptions may be made if:
- The principal purpose of the web application is to spawn, facilitate, manage, execute, or monitor such background jobs, or
- Running background jobs in the same process as the web application will cause significant performance, stability, or security issues.
- Exceptions may be made if:
- DO NOT write business logic in controller classes. DO write business logic in service classes that do not have any concerns or knowledge of web requests & responses. Such classes can be directly tested with unit tests, can be easily called from other services classes to facilitate code re-use and consistency.
- 主要語言
- C#
- 星號
- 12
- 分支
- 16
- 平均合併
- 5 分鐘
- 30 天內合併 PR
- 12
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
IntelliTect/CodingGuidelines 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 25/100
IntelliTect/CodingGuidelines#290 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 45/100
IntelliTect/CodingGuidelines#253 ·
維護者通常 1 天內回覆
-
Review naming recommendation for fields可能重新可做 @MarkMichaelis 於 1340 天前認領,目前沒有進行中的 PR。 未關閉.editorconfig C# coding guidelines proposal
IntelliTect/CodingGuidelines#249 · 6 則留言 · 1 個 reaction · 已指派 2 人 ·
維護者通常 1 天內回覆
-
analyzer C# coding guidelines proposal
難度 5/5 一週以上 新手友好度 35/100
IntelliTect/CodingGuidelines#231 ·
維護者通常 1 天內回覆
-
bug
難度 3/5 1-2 天 新手友好度 35/100
IntelliTect/CodingGuidelines#230 ·
維護者通常 1 天內回覆
查看 IntelliTect/CodingGuidelines 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 73/100
nightscout/nocturne#2135 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 86/100
Devolutions/UniGetUI#5541 ·
維護者通常 1 天內回覆
-
agentic-workflows Needs: Triage :mag:
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
[誤判定]未關閉linux アプリ: ブラウザー 再現済み 要トリアージ 誤判定
難度 2/5 1-3 小時 新手友好度 72/100
yksr-melt/Meltype#853 · 2 則留言 ·
維護者通常 1 天內回覆