Skip to content

Commit 35e7b92

Browse files
committed
start mixin
1 parent b04b6c1 commit 35e7b92

File tree

7 files changed

+88
-1
lines changed

7 files changed

+88
-1
lines changed

v2/RSCGExamplesData/NoExample.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@
844844
{
845845
"ID":194,
846846
"name":"https://github.com/ramhari-dev/PropGenAoT",
847-
"why":"later"
847+
"why":"no readme"
848848
},
849849

850850
{
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"generator":{
3+
"name":"JinShil.MixinSourceGenerator",
4+
"nuget":[
5+
"https://www.nuget.org/packages/JinShil.MixinSourceGenerator/"
6+
],
7+
"link":"https://github.com/JinShil/JinShil.MixinSourceGenerator",
8+
"author":"Jin Shil",
9+
"source":"https://github.com/JinShil/JinShil.MixinSourceGenerator"
10+
},
11+
"data":{
12+
"goodFor":["Generate mixins of classes"],
13+
"csprojDemo":"DemoMixin.csproj",
14+
"csFiles":["Program.cs","Person.cs","LogData.cs"],
15+
"excludeDirectoryGenerated":[""],
16+
"includeAdditionalFiles":[""]
17+
},
18+
"links":{
19+
"blog":"",
20+
"video":""
21+
}
22+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34902.84
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoMixin", "DemoMixin\DemoMixin.csproj", "{7B66FED6-7EF9-4260-97AB-D8CB47C1BDF1}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{7B66FED6-7EF9-4260-97AB-D8CB47C1BDF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{7B66FED6-7EF9-4260-97AB-D8CB47C1BDF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{7B66FED6-7EF9-4260-97AB-D8CB47C1BDF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{7B66FED6-7EF9-4260-97AB-D8CB47C1BDF1}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {73C5DB4A-663A-4D77-A611-E65ADCDDD770}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<PropertyGroup>
11+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
12+
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
13+
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<PackageReference Include="JinShil.MixinSourceGenerator" Version="1.0.0">
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
20+
</ItemGroup>
21+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+

2+
namespace DemoMixin;
3+
internal class LogData
4+
{
5+
public void Log(string data) => Console.WriteLine(data);
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+

2+
using JinShil.MixinSourceGenerator;
3+
namespace DemoMixin;
4+
[Mixin(typeof(LogData))]
5+
partial class Person
6+
{
7+
public string Name { get; set; }=string.Empty;
8+
public void LogName() => this.Log(Name);
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
using DemoMixin;
2+
3+
Person person = new Person { Name = "Andrei Ignat" };
4+
person.LogName();

0 commit comments

Comments
 (0)