Architecture Guidelines
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Documentazione
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- csharp
- Ambito
- documentation
Direzione di ricerca
Inizia esaminando il README e i documenti esistenti sulle linee guida di codifica nel repository, quindi confrontali con le sezioni proposte Project documentation, General Architecture e Web Application Architecture. L’issue non indica file né definisce un ambito concordato; per considerarla completata sarebbero necessari un insieme di linee guida accettato e attuabile e una posizione chiara in cui collocarlo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C#
- Stelle
- 12
- Fork
- 16
- Merge medio
- 2m
- PR unite (30g)
- 10
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di IntelliTect/CodingGuidelines
-
Overriding ToString() Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
IntelliTect/CodingGuidelines#290 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
IntelliTect/CodingGuidelines#253 ·
-
.editorconfig C# coding guidelines proposal
IntelliTect/CodingGuidelines#249 · 6 commenti · 1 reazione · 2 assegnatari ·
-
INTL0001 when using records Apertaanalyzer C# coding guidelines proposal
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
IntelliTect/CodingGuidelines#231 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
IntelliTect/CodingGuidelines#230 ·
Tutte le issue di IntelliTect/CodingGuidelines
Issue simili
-
untriaged
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
dotnet/dotnet-api-docs#13095 ·
-
area-deployment area-integrations triage:bot-seen
Difficoltà 2/5 Mezza giornata Idoneità per principianti 86/100
-
type/automation type/tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
newrelic/newrelic-dotnet-agent#3850 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
LuckyPennySoftware/AutoMapper#4660 ·