Closed jezzsantos closed 8 months ago
commit 6c6fcd48eb535ceb24c75bdb780f8f68b02306a4 implemented the first few diagnostics
commit 04eb2d516310a6913f495fff0b2dc54d6d9c78a0 added project templates, which enforce the project references for the second part.
Not sure its worth implementing a Roslyn analyzer for a *.csproj file, since most developers don't spend much time inside them and may never see the diagnostics. However, the build warnings may direct them there. Can investigate
Roslyn rules for Aggregates and value objects:
public static AggregateRootFactory<TAggregateRoot> Rehydrate()
methodpublic override Dictionary<string, object?> Dehydrate
method[EntityName("AName")]
attribute on the classpublic override Dictionary<string, object?> Dehydrate
methodpublic static EntityFactory<TEntity> Rehydrate()
method[EntityName("AName")]
attribute on the classpublic static ValueObjectFactory<TValueObject> Rehydrate()
methodArchitecture Tests library NetArchTest, or ArchUnit NetArchUnit: https://www.youtube.com/watch?v=eWjNLYNS-og
IWebResponse
derivative types must have primitives or Resources (Nullables, no Optionals) and must have public getters and setters?IWebRequest
derivative types must have primitives or Resources (Nullables, no Optionals) and must have public getters and setters?typeof(string), typeof(int), typeof(long), typeof(double), typeof(DateOnly), typeof(DateTime), typeof(decimal), typeof(bool), typeof(Stream), typeof(byte)
) (nullable, not Optional)typeof(string), typeof(int), typeof(long), typeof(double), typeof(DateTime), typeof(decimal), typeof(bool), typeof(byte)
) (Optional not nullable)sealed
typeof(string), typeof(int), typeof(long), typeof(double), typeof(DateTime), typeof(decimal), typeof(bool), typeof(byte)
) or enums (Optional not nullable)Last rule: (probably Roslyn)
Foreach ISubDomainModule
, if the DomainAssembly
property has a type (as opposed to null),
then load that type, and scan all entities and aggregates, and make sure they have entries in the AggregatePrefixes
property
CodeFixes:
public
These coding rules should be backed by Rosyln Analyzers and Code Fixes.
API Class
Location: any project with variable:
<HasApi>true</HasApi>
Definition: Any instance method of an API class (instance class derived fromIWebApiService
)Rules:
Task<T>
orT
, whereT
is eitherApiEmptyResult
orApiResult<TResource, TResponse>
orApiPostResult<TResource, TResponse>
.IWebRequest<TResponse>
, where TResponse is same type as in the return value. Second parameter can only be aCancellationToken
WebApiRouteAttribute
TRequest
API project file (csproj)
Location: any project with variable:
<HasApi>true</HasApi>
Definition: N/ARules:
SaaStack.Tools.Generators.WebApi
or a project reference toTools.Generators.WebApi.csproj