Skip to content

Commit bc8bf0f

Browse files
feat: Implement core configuration classes and attributes for documentation generation
1 parent ef5f0fd commit bc8bf0f

19 files changed

+133
-157
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace DotAutoDocConfig.Core.ComponentModel.Attributes;
4+
5+
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
6+
public class DocumentationAttribute(DocumentationFormat format) : Attribute
7+
{
8+
public DocumentationFormat Format { get; } = format;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace DotAutoDocConfig.Core.ComponentModel.Attributes;
4+
5+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
6+
public class ExcludeFromDocumentationAttribute(string? reason = null) : Attribute
7+
{
8+
public string? Reason { get; } = reason;
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace DotAutoDocConfig.Core.ComponentModel;
4+
5+
[Flags]
6+
public enum DocumentationFormat : byte
7+
{
8+
None = 0,
9+
AsciiDoc = 1 << 0,
10+
Markdown = 1 << 1,
11+
Html = 1 << 2
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<LangVersion>latest</LangVersion>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using DotAutoDocConfig.Core.ComponentModel;
2+
using DotAutoDocConfig.Core.ComponentModel.Attributes;
3+
4+
namespace DotAutoDocConfig.Sample.Console;
5+
6+
/// <summary>
7+
///
8+
/// </summary>
9+
[Documentation(DocumentationFormat.Markdown | DocumentationFormat.AsciiDoc)]
10+
public class AppConfiguration
11+
{
12+
public int MaxItems { get; set; } = 100;
13+
14+
public string ApplicationName { get; set; } = "DotAutoDocConfig Sample App";
15+
16+
public bool EnableLogging { get; set; } = true;
17+
18+
public double TimeoutInSeconds { get; set; } = 30.0;
19+
20+
public string[] SupportedLanguages { get; set; } = ["en", "es", "fr"];
21+
22+
public DatabaseConfiguration Database { get; set; } = new();
23+
24+
[ExcludeFromDocumentation("This property is for internal use only.")]
25+
public int RetryAttempts { get; set; } = 3;
26+
}
27+
28+
public class DatabaseConfiguration
29+
{
30+
public string ConnectionString { get; set; } = "Server=localhost;Database=mydb;User Id=myuser;Password=mypassword;";
31+
32+
public int MaxConnections { get; set; } = 10;
33+
34+
[ExcludeFromDocumentation("This property is for internal use only.")]
35+
public bool UseSsl { get; set; } = false;
36+
37+
public int CommandTimeout { get; set; } = 60;
38+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net10.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\DotAutoDocConfig\DotAutoDocConfig.csproj" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// See https://aka.ms/new-console-template for more information
2+
3+
Console.WriteLine("Hello, World!");
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Debug",
5+
"System": "Information",
6+
"Microsoft": "Information"
7+
}
8+
}
9+
}

DotAutoDocConfig.SourceGenerator.Sample/DDD.UbiquitousLanguageRegistry.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

DotAutoDocConfig.SourceGenerator.Sample/DotAutoDocConfig.SourceGenerator.Sample.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,4 @@
66
<ItemGroup>
77
<ProjectReference Include="..\DotAutoDocConfig.SourceGenerator\DotAutoDocConfig.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
88
</ItemGroup>
9-
<ItemGroup>
10-
<None Remove="DDD.UbiquitousLanguageRegistry.txt" />
11-
<AdditionalFiles Include="DDD.UbiquitousLanguageRegistry.txt" />
12-
</ItemGroup>
139
</Project>

0 commit comments

Comments
 (0)