Skip to content

Commit 12c140d

Browse files
authored
Merge pull request #28 from DeeJayTC/fix'n'feature
0.5.0
2 parents 9217b55 + 8d12db4 commit 12c140d

File tree

119 files changed

+3445
-1312
lines changed

Some content is hidden

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

119 files changed

+3445
-1312
lines changed

TCDev.APIGenerator.sln

Lines changed: 68 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAppNuget", "sample\Sa
2424
EndProject
2525
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TCDev.APIGenerator.Json", "src\TCDev.APIGenerator.DbFirst\TCDev.APIGenerator.Json.csproj", "{7F3574D1-7421-4824-A0BB-522F3BC9BAC4}"
2626
EndProject
27-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAppJson", "sample\SampleAppJson\SampleAppJson.csproj", "{25AE6B2A-822D-411B-AB65-068E9E0E41D5}"
27+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TCDev.APIGenerator.Data.SQL", "src\TCDev.APIGenerator.Data.SQL\TCDev.APIGenerator.Data.SQL.csproj", "{E25C6E5E-9726-46A9-958D-D2B92343479D}"
28+
EndProject
29+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TCDev.APIGenerator.Data.SQLite", "src\TCDev.APIGenerator.Data.SQLite\TCDev.APIGenerator.Data.SQLite.csproj", "{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}"
30+
EndProject
31+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TCDev.APIGenerator.Data.Postgres", "src\TCDev.APIGenerator.Data.Postgres\TCDev.APIGenerator.Data.Postgres.csproj", "{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}"
32+
EndProject
33+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TCDev.APIGenerator.OData", "src\TCDev.APIGenerator.OData\TCDev.APIGenerator.OData.csproj", "{2A2C14DD-913D-456C-9427-DB9ABDF340B3}"
34+
EndProject
35+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TCDev.APIGenerator.Data", "src\TCDev.APIGenerator.Data\TCDev.APIGenerator.Data.csproj", "{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}"
36+
EndProject
37+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{AEC50A6A-A13F-4E40-A8FC-BA5F10DD5DF9}"
2838
EndProject
2939
Global
3040
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -45,7 +55,6 @@ Global
4555
{FE869C02-6C9A-4D9B-BBE2-56F1B21B2A55}.SampleAppJson|Any CPU.Build.0 = SampleAppJson|Any CPU
4656
{FE869C02-6C9A-4D9B-BBE2-56F1B21B2A55}.SampleAppNuget|Any CPU.ActiveCfg = SampleAppNuget|Any CPU
4757
{303BF897-594C-4911-91CF-3887A8B8E839}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48-
{303BF897-594C-4911-91CF-3887A8B8E839}.Debug|Any CPU.Build.0 = Debug|Any CPU
4958
{303BF897-594C-4911-91CF-3887A8B8E839}.DebugWithSampleApp|Any CPU.ActiveCfg = DebugWithSampleApp|Any CPU
5059
{303BF897-594C-4911-91CF-3887A8B8E839}.DebugWithSampleApp|Any CPU.Build.0 = DebugWithSampleApp|Any CPU
5160
{303BF897-594C-4911-91CF-3887A8B8E839}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -81,28 +90,73 @@ Global
8190
{7F3574D1-7421-4824-A0BB-522F3BC9BAC4}.SampleAppJson|Any CPU.ActiveCfg = SampleAppJson|Any CPU
8291
{7F3574D1-7421-4824-A0BB-522F3BC9BAC4}.SampleAppNuget|Any CPU.ActiveCfg = SampleAppNuget|Any CPU
8392
{7F3574D1-7421-4824-A0BB-522F3BC9BAC4}.SampleAppNuget|Any CPU.Build.0 = SampleAppNuget|Any CPU
84-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
85-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
86-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.DebugWithSampleApp|Any CPU.ActiveCfg = DebugWithSampleApp|Any CPU
87-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.DebugWithSampleApp|Any CPU.Build.0 = DebugWithSampleApp|Any CPU
88-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
89-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.Release|Any CPU.Build.0 = Release|Any CPU
90-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.SampleAppJson|Any CPU.ActiveCfg = SampleAppJson|Any CPU
91-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.SampleAppJson|Any CPU.Build.0 = SampleAppJson|Any CPU
92-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.SampleAppNuget|Any CPU.ActiveCfg = SampleAppNuget|Any CPU
93-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5}.SampleAppNuget|Any CPU.Build.0 = SampleAppNuget|Any CPU
93+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
94+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.Debug|Any CPU.Build.0 = Debug|Any CPU
95+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.DebugWithSampleApp|Any CPU.ActiveCfg = Debug|Any CPU
96+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.DebugWithSampleApp|Any CPU.Build.0 = Debug|Any CPU
97+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.Release|Any CPU.ActiveCfg = Release|Any CPU
98+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.Release|Any CPU.Build.0 = Release|Any CPU
99+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.SampleAppJson|Any CPU.ActiveCfg = Debug|Any CPU
100+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.SampleAppJson|Any CPU.Build.0 = Debug|Any CPU
101+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.SampleAppNuget|Any CPU.ActiveCfg = Debug|Any CPU
102+
{E25C6E5E-9726-46A9-958D-D2B92343479D}.SampleAppNuget|Any CPU.Build.0 = Debug|Any CPU
103+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
104+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
105+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.DebugWithSampleApp|Any CPU.ActiveCfg = Debug|Any CPU
106+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.DebugWithSampleApp|Any CPU.Build.0 = Debug|Any CPU
107+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
108+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.Release|Any CPU.Build.0 = Release|Any CPU
109+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.SampleAppJson|Any CPU.ActiveCfg = Debug|Any CPU
110+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.SampleAppJson|Any CPU.Build.0 = Debug|Any CPU
111+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.SampleAppNuget|Any CPU.ActiveCfg = Debug|Any CPU
112+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1}.SampleAppNuget|Any CPU.Build.0 = Debug|Any CPU
113+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
115+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.DebugWithSampleApp|Any CPU.ActiveCfg = Debug|Any CPU
116+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.DebugWithSampleApp|Any CPU.Build.0 = Debug|Any CPU
117+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
118+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.Release|Any CPU.Build.0 = Release|Any CPU
119+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.SampleAppJson|Any CPU.ActiveCfg = Debug|Any CPU
120+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.SampleAppJson|Any CPU.Build.0 = Debug|Any CPU
121+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.SampleAppNuget|Any CPU.ActiveCfg = Debug|Any CPU
122+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2}.SampleAppNuget|Any CPU.Build.0 = Debug|Any CPU
123+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
124+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
125+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.DebugWithSampleApp|Any CPU.ActiveCfg = Debug|Any CPU
126+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.DebugWithSampleApp|Any CPU.Build.0 = Debug|Any CPU
127+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
128+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.Release|Any CPU.Build.0 = Release|Any CPU
129+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.SampleAppJson|Any CPU.ActiveCfg = Debug|Any CPU
130+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.SampleAppJson|Any CPU.Build.0 = Debug|Any CPU
131+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.SampleAppNuget|Any CPU.ActiveCfg = Debug|Any CPU
132+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3}.SampleAppNuget|Any CPU.Build.0 = Debug|Any CPU
133+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
134+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.Debug|Any CPU.Build.0 = Debug|Any CPU
135+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.DebugWithSampleApp|Any CPU.ActiveCfg = Debug|Any CPU
136+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.DebugWithSampleApp|Any CPU.Build.0 = Debug|Any CPU
137+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.Release|Any CPU.ActiveCfg = Release|Any CPU
138+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.Release|Any CPU.Build.0 = Release|Any CPU
139+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.SampleAppJson|Any CPU.ActiveCfg = Debug|Any CPU
140+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.SampleAppJson|Any CPU.Build.0 = Debug|Any CPU
141+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.SampleAppNuget|Any CPU.ActiveCfg = Debug|Any CPU
142+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13}.SampleAppNuget|Any CPU.Build.0 = Debug|Any CPU
94143
EndGlobalSection
95144
GlobalSection(SolutionProperties) = preSolution
96145
HideSolutionNode = FALSE
97146
EndGlobalSection
98147
GlobalSection(NestedProjects) = preSolution
99148
{FE869C02-6C9A-4D9B-BBE2-56F1B21B2A55} = {4189D7E0-F171-4267-AC64-C9A83BB1B559}
100149
{303BF897-594C-4911-91CF-3887A8B8E839} = {8CC9B68F-E1C2-45B3-8814-B9FF4E1B2AB8}
101-
{0C8E23AD-AC5D-41D4-9F67-0ECF3D1C4BE1} = {4189D7E0-F171-4267-AC64-C9A83BB1B559}
150+
{0C8E23AD-AC5D-41D4-9F67-0ECF3D1C4BE1} = {AEC50A6A-A13F-4E40-A8FC-BA5F10DD5DF9}
102151
{94E59385-D259-40A1-A373-1FBD0A42CD63} = {4189D7E0-F171-4267-AC64-C9A83BB1B559}
103152
{BA9E04E6-4B66-4369-9B2F-C6CEC9499851} = {8CC9B68F-E1C2-45B3-8814-B9FF4E1B2AB8}
104153
{7F3574D1-7421-4824-A0BB-522F3BC9BAC4} = {4189D7E0-F171-4267-AC64-C9A83BB1B559}
105-
{25AE6B2A-822D-411B-AB65-068E9E0E41D5} = {8CC9B68F-E1C2-45B3-8814-B9FF4E1B2AB8}
154+
{E25C6E5E-9726-46A9-958D-D2B92343479D} = {AEC50A6A-A13F-4E40-A8FC-BA5F10DD5DF9}
155+
{F3D0FB69-D2AC-4501-91DE-F6EC95EF95E1} = {AEC50A6A-A13F-4E40-A8FC-BA5F10DD5DF9}
156+
{2F3E8CF2-3A0F-4A8E-BDB5-C638A68CA6C2} = {AEC50A6A-A13F-4E40-A8FC-BA5F10DD5DF9}
157+
{2A2C14DD-913D-456C-9427-DB9ABDF340B3} = {4189D7E0-F171-4267-AC64-C9A83BB1B559}
158+
{6F6C5270-CF13-427F-A13B-B8EA7BCFEE13} = {4189D7E0-F171-4267-AC64-C9A83BB1B559}
159+
{AEC50A6A-A13F-4E40-A8FC-BA5F10DD5DF9} = {4189D7E0-F171-4267-AC64-C9A83BB1B559}
106160
EndGlobalSection
107161
GlobalSection(ExtensibilityGlobals) = postSolution
108162
SolutionGuid = {315BF454-8B91-42C5-A113-B59C72AE69C8}

sample/ApiGeneratorSampleApp/ApiGeneratorSampleApI.csproj

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,11 @@
1919
</PropertyGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="GraphQL" Version="4.6.1" />
23-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.3" />
24-
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.3" />
25-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.3" />
26-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.3">
27-
<PrivateAssets>all</PrivateAssets>
28-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
29-
</PackageReference>
30-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.3" />
31-
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Design" Version="1.1.6" />
32-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
33-
<PackageReference Include="Microsoft.Identity.Web" Version="1.23.0" />
34-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
35-
<PackageReference Include="TCDev.ApiGenerator" Version="0.1.0-alpha" />
36-
</ItemGroup>
37-
38-
<ItemGroup>
22+
<ProjectReference Include="..\..\src\TCDev.APIGenerator.Data.SQL\TCDev.APIGenerator.Data.SQL.csproj" />
23+
<ProjectReference Include="..\..\src\TCDev.APIGenerator.Data\TCDev.APIGenerator.Data.csproj" />
24+
<ProjectReference Include="..\..\src\TCDev.APIGenerator.DbFirst\TCDev.APIGenerator.Json.csproj" />
25+
<ProjectReference Include="..\..\src\TCDev.APIGenerator.OData\TCDev.APIGenerator.OData.csproj" />
3926
<ProjectReference Include="..\..\src\TCDev.APIGenerator\TCDev.APIGenerator.csproj" />
40-
<ProjectReference Include="..\..\src\TCDev.ApiGenerator.Json\TCDev.ApiGenerator.Json.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
4127
</ItemGroup>
4228

4329
<ItemGroup>
@@ -46,6 +32,14 @@
4632
</None>
4733
</ItemGroup>
4834

35+
<ItemGroup>
36+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.4">
37+
<PrivateAssets>all</PrivateAssets>
38+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
39+
</PackageReference>
40+
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.3.1" />
41+
</ItemGroup>
42+
4943
<ItemGroup>
5044
<Content Update="ApiDefinition.json">
5145
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

sample/ApiGeneratorSampleApp/ApiGeneratorSampleApI.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 68 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,70 @@
1-
//using System;
2-
//using System.Collections.Generic;
3-
//using System.ComponentModel.DataAnnotations;
4-
//using System.ComponentModel.DataAnnotations.Schema;
5-
//using TCDev.ApiGenerator.Attributes;
6-
//using TCDev.ApiGenerator.Interfaces;
7-
8-
//namespace ApiGeneratorSampleApI.Model
9-
//{
10-
11-
// [Api("/students")]
12-
// public class Student: IObjectBase<int>
13-
// {
14-
// public int Id { get; set; }
15-
// public string FirstName { get; set; }
16-
// public string LastName { get; set; }
17-
// public DateTime DateOfBirth { get; set; }
18-
19-
// public void BeforeDelete(Student student)
20-
// {
21-
// // Before Delete hook to make custom validations
22-
// }
23-
24-
// }
25-
26-
27-
// [Api("/teachers")]
28-
// public class Teacher : IObjectBase<int>
29-
// {
30-
// public int Id { get; set; }
31-
// public string FirstName { get; set; }
32-
// public string LastName { get; set; }
33-
// public DateTime DateOfBirth { get; set; }
34-
35-
// public void BeforeCreate(Teacher newTeacher)
36-
// {
37-
// // Before Create hook to make custom validations
38-
// }
39-
// }
40-
41-
42-
// [Api("/courses")]
43-
// public class Course : IObjectBase<int>
44-
// {
45-
// public int Id { get; set; }
46-
// public List<Student> Students { get; set; }
47-
// public Teacher Teacher { get; set; }
48-
// public List<DateTime> Schedule { get; set; }
49-
// }
50-
51-
52-
53-
54-
// [Api("/car"]
55-
// public class Car : IObjectBase<Guid>
56-
// {
57-
// [Key]
58-
// [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
59-
// [SwaggerIgnore]
60-
// public Guid Id { get; set; } = Guid.NewGuid();
61-
62-
63-
// [EmailAddress]
64-
// public string Name { get; set; }
65-
66-
// public string Description { get; set; }
67-
68-
// public string Color { get; set; }
69-
70-
// public Make? Make { get; set; }
71-
72-
// public Model? Model { get; set; }
73-
// }
74-
75-
76-
// [Api("/carMakes",
77-
// authorize: true,
78-
// requiredReadScopes: new string[] { "make.read" },
79-
// requiredWriteScopes: new string[] { "make.write" })]
80-
// public class Make : IObjectBase<Guid>
81-
// {
82-
// [Key]
83-
// [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
84-
// [SwaggerIgnore]
85-
// public Guid Id { get; set; } = Guid.NewGuid();
86-
// public string Name { get; set; }
87-
88-
// public string Description { get; set; }
89-
90-
91-
// public Model? Model { get; set; }
92-
// }
93-
94-
95-
96-
// [Api("/carModel",
97-
// authorize: true,
98-
// requiredReadScopes: new string[] { "model.read" },
99-
// requiredWriteScopes: new string[] { "model.write" })]
100-
// public class Model : IObjectBase<Guid>, I
101-
// {
102-
// [Key]
103-
// [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
104-
// [SwaggerIgnore]
105-
// public Guid Id { get; set; } = Guid.NewGuid();
106-
// public string Name { get; set; }
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations;
4+
using System.ComponentModel.DataAnnotations.Schema;
5+
using TCDev.APIGenerator.Attributes;
6+
using TCDev.APIGenerator.Interfaces;
1077

108-
// public string Description { get; set; }
109-
// }
8+
namespace ApiGeneratorSampleApI.Model
9+
{
11010

111-
//}
11+
[Api("/car")]
12+
13+
[Table("Carlala")]
14+
public class Car : IObjectBase<Guid>
15+
{
16+
[Key]
17+
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
18+
[SwaggerIgnore]
19+
public Guid Id { get; set; } = Guid.NewGuid();
20+
21+
22+
[EmailAddress]
23+
public string Name { get; set; }
24+
25+
public string Description { get; set; }
26+
27+
public string Color { get; set; }
28+
29+
public Make? Make { get; set; }
30+
31+
public Model? Model { get; set; }
32+
}
33+
34+
35+
[Api("/carMakes",
36+
authorize: true,
37+
requiredReadScopes: new string[] { "make.read" },
38+
requiredWriteScopes: new string[] { "make.write" })]
39+
public class Make : IObjectBase<Guid>
40+
{
41+
[Key]
42+
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
43+
[SwaggerIgnore]
44+
public Guid Id { get; set; } = Guid.NewGuid();
45+
public string Name { get; set; }
46+
47+
public string Description { get; set; }
48+
49+
50+
public Model? Model { get; set; }
51+
}
52+
53+
54+
55+
[Api("/carModel",
56+
authorize: true,
57+
requiredReadScopes: new string[] { "model.read" },
58+
requiredWriteScopes: new string[] { "model.write" })]
59+
public class Model : IObjectBase<Guid>
60+
{
61+
[Key]
62+
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
63+
[SwaggerIgnore]
64+
public Guid Id { get; set; } = Guid.NewGuid();
65+
public string Name { get; set; }
66+
67+
public string Description { get; set; }
68+
}
69+
70+
}
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
//// TCDev.de 2022/03/24
2-
//// ApiGeneratorSampleApI.MinimalSample.cs
3-
//// https://github.com/DeeJayTC/net-dynamic-api
1+
// TCDev.de 2022/03/24
2+
// ApiGeneratorSampleApI.MinimalSample.cs
3+
// https://github.com/DeeJayTC/net-dynamic-api
44

5-
//using TCDev.ApiGenerator.Attributes;
6-
//using TCDev.ApiGenerator.Interfaces;
5+
using TCDev.APIGenerator.Attributes;
6+
using TCDev.APIGenerator.Interfaces;
77

8-
//namespace ApiGeneratorSampleApI.Model
9-
//{
10-
// /// <summary>
11-
// /// This is the minimal sample, yes this is a working api ;)
12-
// /// </summary>
13-
// [Api("/minimal")]
14-
// public class MinimalSample : IObjectBase<int>
15-
// {
16-
// public string Name { get; set; }
17-
// public int Value { get; set; }
18-
// public int Id { get; set; }
19-
// }
20-
//}
8+
namespace ApiGeneratorSampleApI.Model
9+
{
10+
/// <summary>
11+
/// This is the minimal sample, yes this is a working api ;)
12+
/// </summary>
13+
[Api("/minimal")]
14+
public class MinimalSample : IObjectBase<int>
15+
{
16+
public string Name { get; set; }
17+
public int Value { get; set; }
18+
public int Id { get; set; }
19+
}
20+
}

0 commit comments

Comments
 (0)