Skip to content

Commit 15cd12d

Browse files
committed
Updated readme
1 parent 837f067 commit 15cd12d

File tree

2 files changed

+55
-28
lines changed

2 files changed

+55
-28
lines changed

CodeFirstApi.sln

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
4-
VisualStudioVersion = 17.14.35821.62 d17.14
4+
VisualStudioVersion = 17.14.35821.62
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeFirstApi.Generator", "src\CodeFirstApi.Generator\CodeFirstApi.Generator.csproj", "{7DAA6C1C-F0F8-4C1A-B7DE-889C4895155F}"
77
EndProject
@@ -17,7 +17,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp", "samples\Blazor
1717
EndProject
1818
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp.Client", "samples\BlazorApp.Client\BlazorApp.Client.csproj", "{F614D232-D1A6-49C7-AC52-56E969345E65}"
1919
EndProject
20-
20+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
21+
ProjectSection(SolutionItems) = preProject
22+
readme.md = readme.md
23+
EndProjectSection
24+
EndProject
2125
Global
2226
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2327
Debug|Any CPU = Debug|Any CPU
@@ -48,14 +52,14 @@ Global
4852
GlobalSection(SolutionProperties) = preSolution
4953
HideSolutionNode = FALSE
5054
EndGlobalSection
51-
GlobalSection(ExtensibilityGlobals) = postSolution
52-
SolutionGuid = {83BF86F4-3141-4EEB-8255-4BDF0D9F2908}
53-
EndGlobalSection
5455
GlobalSection(NestedProjects) = preSolution
55-
{99170F5C-7544-4AA3-BEF9-DDF8FB8479DA} = {3D04D386-924F-4806-B518-24A043A0BE12}
5656
{7DAA6C1C-F0F8-4C1A-B7DE-889C4895155F} = {3D04D386-924F-4806-B518-24A043A0BE12}
57+
{99170F5C-7544-4AA3-BEF9-DDF8FB8479DA} = {3D04D386-924F-4806-B518-24A043A0BE12}
5758
{C9255E21-4733-40B3-BA9C-1F2EBC2D9759} = {5F077FC5-A9E9-4AE8-BED3-058F580C0087}
5859
{646F61A1-20FC-4922-9181-D72DA69F50DA} = {5F077FC5-A9E9-4AE8-BED3-058F580C0087}
5960
{F614D232-D1A6-49C7-AC52-56E969345E65} = {5F077FC5-A9E9-4AE8-BED3-058F580C0087}
6061
EndGlobalSection
62+
GlobalSection(ExtensibilityGlobals) = postSolution
63+
SolutionGuid = {83BF86F4-3141-4EEB-8255-4BDF0D9F2908}
64+
EndGlobalSection
6165
EndGlobal

readme.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,37 @@ Mainly a generator project, to create REST API and appropriate interfaces for ea
44
- Based on interface definition in Shared project
55
- Create Controller based REST API, to be used in Backend (respecting Authorize attribute).
66
- Create a client to be used in Razor Components in WebAssembly Render mode, which calls the REST API above.
7-
- Add wrapper around the service implmentation in Backend for use in ServerSide Render mode, so it is protected as the REST API is.
7+
- Add wrapper around the service implementation in Backend for use in ServerSide Render mode, so it is protected as the REST API is.
88
- For the wrappers used when running on the server and in browser, to automatically implement State Persistance for use in Prerendering (to remove the flicker on mode change with prerendering)
99

10-
# Usage
10+
This means, that you define the interface in Shared project, and the generator will create the necessary code for you.
11+
Handling different render modes as needed and abstracting away the details from Razor Components pages.
12+
13+
Adding or updating the API, means adding a method any of the existing marked interfaces or creating new interfaces in the shared project.
14+
And of course implementing this interface in the backend and adding it to the DI container.
15+
16+
17+
# Supported attributes
18+
19+
- GenerateHttpClients
20+
- Assembly attribute, generates the clients for the services, to be used in Client project.
21+
- GenerateHttpControllers
22+
- Assembly attribute, generates the controllers and service wrappers, to be used in Backend project.
23+
- GenerateServices
24+
- Interface attribute, marks the interface as a service, to be used by the generator.
25+
- PersistForPrerendering
26+
- Generates the code for Persisting the pre-rendered state of the component, based on https://learn.microsoft.com/en-us/aspnet/core/blazor/components/prerender?view=aspnetcore-9.0#persist-prerendered-state
27+
- Authorize
28+
- Interface or method attribute, marks the interface or method as requiring authorization (uses the same definition as the built-in version of this attribute but is for use with interfaces).
29+
30+
31+
# Usage examples
32+
1133
See the project in the `sample` folder.
1234

13-
# Version info
35+
36+
# Usage notice
37+
1438
This is only pre-alpha version for evaluating the idea, and not yet ready for production use.
1539
Nuget package will not be released later on when the code is a bit more stable.
1640

@@ -23,26 +47,25 @@ Nuget package will not be released later on when the code is a bit more stable.
2347
- add Verb attribute (can be combined with route)
2448
- add allow anonymous attribute
2549
- release as Nuget package
26-
50+
- have a demo app deployment
2751

2852

2953
## Similar
3054

31-
# https://github.com/reactiveui/refit
32-
- Generate a REST client from code
33-
- ie code first but only for REST Client, not for server side
34-
- Seems alternative to Swagger somehow
35-
36-
# https://github.com/canton7/RestEase
37-
- Inspired by Refit
38-
- Seems generally the same, generate clients
39-
40-
41-
https://github.com/bpawluk/EasyApi
42-
- Handles both client and server side
43-
- But each request is a separate class
44-
- A bit too verbose due to that
45-
- And due to the class per method, quite a lot needs to be injected to use adjecent functionality
46-
- the `@inject ICall<AddComment, Guid> AddComment` is a good example of that
47-
- you need to know what request class you want to use and what it should return.
48-
- This seems unnecessary.
55+
- https://github.com/reactiveui/refit
56+
- Generate a REST client from code
57+
- ie code first but only for REST Client, not for server side
58+
- Seems alternative to Swagger somehow
59+
60+
- https://github.com/canton7/RestEase
61+
- Inspired by Refit
62+
- Seems generally the same, generate clients
63+
64+
- https://github.com/bpawluk/EasyApi
65+
- Handles both client and server side
66+
- But each request is a separate class
67+
- A bit too verbose due to that
68+
- And due to the class per method, quite a lot needs to be injected to use adjecent functionality
69+
- the `@inject ICall<AddComment, Guid> AddComment` is a good example of that
70+
- you need to know what request class you want to use and what it should return.
71+
- This seems unnecessary.

0 commit comments

Comments
 (0)