Skip to content

Commit 04e7cb5

Browse files
authored
Merge pull request #43 from AterDev/dev-v10
Dev v10
2 parents 29c7324 + 68281f8 commit 04e7cb5

File tree

863 files changed

+26053
-52237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

863 files changed

+26053
-52237
lines changed

.editorconfig

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,128 @@
1-
[*.cs]
1+
[*.cs]
22

33
# RS1014: 不要忽略通过不可变对象上的方法返回的值
44
dotnet_diagnostic.RS1014.severity = silent
5+
6+
[*.cs]
7+
#### 命名样式 ####
8+
9+
# 命名规则
10+
11+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
12+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
13+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
14+
15+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
16+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
17+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
18+
19+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
20+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
21+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
22+
23+
# 符号规范
24+
25+
dotnet_naming_symbols.interface.applicable_kinds = interface
26+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
27+
dotnet_naming_symbols.interface.required_modifiers =
28+
29+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
30+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
31+
dotnet_naming_symbols.types.required_modifiers =
32+
33+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
34+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
35+
dotnet_naming_symbols.non_field_members.required_modifiers =
36+
37+
# 命名样式
38+
39+
dotnet_naming_style.begins_with_i.required_prefix = I
40+
dotnet_naming_style.begins_with_i.required_suffix =
41+
dotnet_naming_style.begins_with_i.word_separator =
42+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
43+
44+
dotnet_naming_style.pascal_case.required_prefix =
45+
dotnet_naming_style.pascal_case.required_suffix =
46+
dotnet_naming_style.pascal_case.word_separator =
47+
dotnet_naming_style.pascal_case.capitalization = pascal_case
48+
49+
dotnet_naming_style.pascal_case.required_prefix =
50+
dotnet_naming_style.pascal_case.required_suffix =
51+
dotnet_naming_style.pascal_case.word_separator =
52+
dotnet_naming_style.pascal_case.capitalization = pascal_case
53+
csharp_using_directive_placement = outside_namespace:silent
54+
csharp_style_expression_bodied_methods = false:silent
55+
csharp_style_expression_bodied_constructors = false:silent
56+
csharp_style_expression_bodied_operators = false:silent
57+
csharp_style_expression_bodied_properties = true:silent
58+
csharp_style_expression_bodied_indexers = true:silent
59+
csharp_style_expression_bodied_accessors = true:silent
60+
csharp_style_expression_bodied_lambdas = when_on_single_line:silent
61+
csharp_style_expression_bodied_local_functions = false:silent
62+
csharp_style_conditional_delegate_call = true:suggestion
63+
csharp_style_var_for_built_in_types = false:silent
64+
csharp_style_var_when_type_is_apparent = false:silent
65+
csharp_style_var_elsewhere = false:silent
66+
csharp_prefer_simple_using_statement = true:suggestion
67+
csharp_prefer_braces = true:silent
68+
csharp_style_prefer_switch_expression = true:suggestion
69+
csharp_style_throw_expression = true:suggestion
70+
dotnet_diagnostic.CA1805.severity = suggestion
71+
72+
[*.vb]
73+
#### 命名样式 ####
74+
75+
# 命名规则
76+
77+
dotnet_naming_rule.interface_should_be_以_i_开始.severity = suggestion
78+
dotnet_naming_rule.interface_should_be_以_i_开始.symbols = interface
79+
dotnet_naming_rule.interface_should_be_以_i_开始.style = 以_i_开始
80+
81+
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.severity = suggestion
82+
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.symbols = 类型
83+
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.style = 帕斯卡拼写法
84+
85+
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.severity = suggestion
86+
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.symbols = 非字段成员
87+
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.style = 帕斯卡拼写法
88+
89+
# 符号规范
90+
91+
dotnet_naming_symbols.interface.applicable_kinds = interface
92+
dotnet_naming_symbols.interface.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
93+
dotnet_naming_symbols.interface.required_modifiers =
94+
95+
dotnet_naming_symbols.类型.applicable_kinds = class, struct, interface, enum
96+
dotnet_naming_symbols.类型.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
97+
dotnet_naming_symbols.类型.required_modifiers =
98+
99+
dotnet_naming_symbols.非字段成员.applicable_kinds = property, event, method
100+
dotnet_naming_symbols.非字段成员.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
101+
dotnet_naming_symbols.非字段成员.required_modifiers =
102+
103+
# 命名样式
104+
105+
dotnet_naming_style.以_i_开始.required_prefix = I
106+
dotnet_naming_style.以_i_开始.required_suffix =
107+
dotnet_naming_style.以_i_开始.word_separator =
108+
dotnet_naming_style.以_i_开始.capitalization = pascal_case
109+
110+
dotnet_naming_style.帕斯卡拼写法.required_prefix =
111+
dotnet_naming_style.帕斯卡拼写法.required_suffix =
112+
dotnet_naming_style.帕斯卡拼写法.word_separator =
113+
dotnet_naming_style.帕斯卡拼写法.capitalization = pascal_case
114+
115+
dotnet_naming_style.帕斯卡拼写法.required_prefix =
116+
dotnet_naming_style.帕斯卡拼写法.required_suffix =
117+
dotnet_naming_style.帕斯卡拼写法.word_separator =
118+
dotnet_naming_style.帕斯卡拼写法.capitalization = pascal_case
119+
120+
[*.{cs,vb}]
121+
dotnet_style_qualification_for_field = false:silent
122+
dotnet_style_qualification_for_property = false:silent
123+
dotnet_style_qualification_for_method = false:silent
124+
dotnet_style_qualification_for_event = false:silent
125+
end_of_line = crlf
126+
dotnet_style_collection_initializer = true:suggestion
127+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
128+
dotnet_diagnostic.CA1852.severity = suggestion

.github/copilot-instructions.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,28 @@
22

33
本仓库是一个使用.NET 开发的命令行工具。请在生成代码时遵循以下指导:
44

5+
**重要原则**
6+
7+
回答的内容必须是确定的,验证的,而不是按概率生成,无法确定和验证的要说明!准确性和确定性是最重要的,否则宁愿不回答。
8+
9+
使用Agent模式时,在生成代码后,不要通过`run_build`来构建项目验证错误,而是通过编辑器的错误提示来验证代码的正确性。
10+
511
**技术栈和语言偏好:**
612

7-
* 主要语言是:C#,前端是TypeScript
8-
* AterStudio项目是 ASP.NET Core
9-
* 前端使用Angular框架
13+
* 主要语言是:C#
14+
* AterStudio项目是 ASP.NET Core和Blazor Server项目
15+
* 前端使用Fluentui-blazor组件库
1016

1117
**重要的文件和目录:**
1218

1319
* `src/Command/CommandLine`: 是命令行程序。
1420
* `src/Definition/CodeGenerator`: 使用roslyn解析和实现代码生成逻辑
1521
* `src/Definition/Entity`: 实体模型项目
16-
* `src/Services/AterStudio`: 是 AterStudio 的服务项目,基于ASP.NET Core
22+
* `src/Services/AterStudio`: 是 AterStudio 的服务项目,基于ASP.NET Core和Blazor Server
1723
* `src/Modules/StudioMod`: 是业务实现的主要模块,AterStudio直接引用该项目。
1824

1925
**代码生成工具:**
2026

2127
以下是在使用 github copilot chat agent 时要遵循的内容:
2228

23-
* 本项目配置了MCP Server `ater.copilot`,提供代码生成功能
24-
* 当要生成前端请求代码时,使用`http://localhost:5278/openapi/admin.json`作为openapi url路径,使用`NgHttp`作为前端请求类型,输出路径是项目根目录下的`/src/Services/ClientApp/src/app`,作为参数时传递完整的绝对路径。
29+
* 对于FluentUI组件库,如果属性大于两个,需要换行对齐属性
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Form Code Generation
2+
3+
## rules
4+
5+
1. 根据提供的描述或代码生成前端表单代码。
6+
2. 要严格遵循指定的UI框架,如FluentUI,AntDesign或Angular Material等。
7+
3. 如果说明要弹窗形式,要有相关的自定义组件代码。
8+
4. 要分析代码中的字段类型和相关特性和注解,如必须和长度限制等,是否为枚举等,以选择合适的表单控件。
9+
10+
## example
11+
12+
对于 FluentUI 框架,组件应该包含Placeholder属性,以及Class="w-100"属性,
13+
生成的表单代码如下所示:
14+
15+
```razor
16+
@implements IDialogContentComponent
17+
18+
<FluentDialogHeader ShowDismiss="false">
19+
<FluentLabel Typo="Typography.PaneHeader">{标题}</FluentLabel>
20+
<FluentLabel Typo="Typography.Subject" Color="Color.Accent">
21+
{描述}
22+
</FluentLabel>
23+
</FluentDialogHeader>
24+
<FluentBodyContent>
25+
<EditForm EditContext="editContext">
26+
<DataAnnotationsValidator />
27+
<FluentValidationSummary />
28+
<FluentStack Orientation="Orientation.Vertical" VerticalGap="12">
29+
<FluentStack Orientation="Orientation.Vertical" VerticalGap="2">
30+
{控件内容1}
31+
</FluentStack>
32+
<FluentStack Orientation="Orientation.Vertical" VerticalGap="2">
33+
{控件内容2}
34+
</FluentStack>
35+
36+
// 更多控件内容...
37+
</FluentStack>
38+
39+
</EditForm>
40+
41+
</FluentBodyContent>
42+
<FluentDialogFooter>
43+
<FluentButton Appearance="Appearance.Accent"
44+
Type="ButtonType.Button"
45+
OnClick="SaveAsync">
46+
@Lang(Localizer.Confirm)
47+
</FluentButton>
48+
<FluentButton Appearance="Appearance.Neutral"
49+
OnClick="CancelAsync">
50+
@Lang(Localizer.Cancel)
51+
</FluentButton>
52+
</FluentDialogFooter>
53+
54+
@code{
55+
[CascadingParameter]
56+
FluentDialog Dialog { get; set; } = null!;
57+
EditContext? editContext;
58+
59+
// 以下替换为给出的模型类
60+
AddProjectDto AddDto { get; set; } = default!;
61+
62+
bool formValid { get;set; }
63+
64+
protected override void OnInitialized()
65+
{
66+
AddDto = new AddProjectDto
67+
{
68+
ProjectName = string.Empty,
69+
ProjectDirectory = string.Empty
70+
};
71+
editContext = new EditContext(AddDto);
72+
editContext.OnFieldChanged += HandleFieldChanged;
73+
}
74+
75+
private void HandleFieldChanged(object? sender, FieldChangedEventArgs e)
76+
{
77+
if (editContext is not null)
78+
{
79+
formValid = editContext.Validate();
80+
StateHasChanged();
81+
}
82+
}
83+
84+
public void Dispose()
85+
{
86+
if (editContext is not null)
87+
{
88+
editContext.OnFieldChanged -= HandleFieldChanged;
89+
}
90+
}
91+
92+
private async Task SaveAsync()
93+
{
94+
if (!editContext!.Validate())
95+
{
96+
ToastService.ShowError(Lang(Localizer.FormValidFailed));
97+
return;
98+
}
99+
// 保存逻辑
100+
}
101+
private async Task CancelAsync()
102+
{
103+
await Dialog.CancelAsync();
104+
}
105+
}
106+
```

.github/prompts/form.prompt.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Form Code Generation
2+
3+
## rules
4+
5+
1. 根据提供的描述或代码生成前端表单代码。
6+
2. 要严格遵循指定的UI框架,如FluentUI,AntDesign或Angular Material等。
7+
3. 如果说明要弹窗形式,要有相关的自定义组件代码。
8+
4. 要分析代码中的字段类型和相关特性和注解,如必须和长度限制等,是否为枚举等,以选择合适的表单控件。
9+
10+
## example
11+
12+
对于 FluentUI 框架,组件应该包含Placeholder属性,以及Class="w-100"属性,
13+
生成的表单代码如下所示:
14+
15+
```razor
16+
@implements IDialogContentComponent
17+
18+
<FluentDialogHeader ShowDismiss="false">
19+
<FluentLabel Typo="Typography.PaneHeader">{标题}</FluentLabel>
20+
<FluentLabel Typo="Typography.Subject" Color="Color.Accent">
21+
{描述}
22+
</FluentLabel>
23+
</FluentDialogHeader>
24+
<FluentBodyContent>
25+
<EditForm EditContext="editContext">
26+
<DataAnnotationsValidator />
27+
<FluentValidationSummary />
28+
<FluentStack Orientation="Orientation.Vertical" VerticalGap="12">
29+
<FluentStack Orientation="Orientation.Vertical" VerticalGap="2">
30+
{控件内容1}
31+
</FluentStack>
32+
<FluentStack Orientation="Orientation.Vertical" VerticalGap="2">
33+
{控件内容2}
34+
</FluentStack>
35+
36+
// 更多控件内容...
37+
</FluentStack>
38+
39+
</EditForm>
40+
41+
</FluentBodyContent>
42+
<FluentDialogFooter>
43+
<FluentButton Appearance="Appearance.Accent"
44+
Type="ButtonType.Button"
45+
OnClick="SaveAsync">
46+
@Lang(Localizer.Confirm)
47+
</FluentButton>
48+
<FluentButton Appearance="Appearance.Neutral"
49+
OnClick="CancelAsync">
50+
@Lang(Localizer.Cancel)
51+
</FluentButton>
52+
</FluentDialogFooter>
53+
54+
@code{
55+
[CascadingParameter]
56+
FluentDialog Dialog { get; set; } = null!;
57+
EditContext? editContext;
58+
59+
// 以下替换为给出的模型类
60+
AddProjectDto AddDto { get; set; } = default!;
61+
62+
bool formValid { get;set; }
63+
64+
protected override void OnInitialized()
65+
{
66+
AddDto = new AddProjectDto
67+
{
68+
ProjectName = string.Empty,
69+
ProjectDirectory = string.Empty
70+
};
71+
editContext = new EditContext(AddDto);
72+
editContext.OnFieldChanged += HandleFieldChanged;
73+
}
74+
75+
private void HandleFieldChanged(object? sender, FieldChangedEventArgs e)
76+
{
77+
if (editContext is not null)
78+
{
79+
formValid = editContext.Validate();
80+
StateHasChanged();
81+
}
82+
}
83+
84+
public void Dispose()
85+
{
86+
if (editContext is not null)
87+
{
88+
editContext.OnFieldChanged -= HandleFieldChanged;
89+
}
90+
}
91+
92+
private async Task SaveAsync()
93+
{
94+
if (!editContext!.Validate())
95+
{
96+
ToastService.ShowError(Lang(Localizer.FormValidFailed));
97+
return;
98+
}
99+
// 保存逻辑
100+
}
101+
private async Task CancelAsync()
102+
{
103+
await Dialog.CancelAsync();
104+
}
105+
}
106+
```

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,3 @@ ater studio
9393
## 📄 文档
9494

9595
[进行中](https://www.dusi.dev/docs/Ater.Dry)
96-
97-
98-
## 🙏 致谢
99-
100-
<p align="left">
101-
<a href="https://www.jetbrains.com/?from=ater.dry.cli">
102-
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo" width="100"/>
103-
</a>
104-
</p>

0 commit comments

Comments
 (0)