-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from ladeak/incremental-generator
Incremental source Generator
- Loading branch information
Showing
65 changed files
with
1,198 additions
and
1,532 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
sample/AspNetCoreMinimal.Entities/AspNetCoreMinimal.Entities.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,13 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:42816", | ||
"sslPort": 44364 | ||
} | ||
}, | ||
"profiles": { | ||
"AspNetCoreMinimal": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"applicationUrl": "https://localhost:5001;http://localhost:5000", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### | ||
|
||
GET https://localhost:5001/Sample/Weather | ||
|
||
### | ||
|
||
PATCH https://localhost:5001/Sample/PatchWeather | ||
Content-Type: application/merge-patch+json | ||
|
||
{ | ||
"temp":23, | ||
"summary":null | ||
} | ||
### | ||
|
||
PATCH https://localhost:5001/Sample/PatchCities | ||
Content-Type: application/merge-patch+json | ||
|
||
{ | ||
"cities": | ||
{ | ||
"Dublin":"Ireland", | ||
"London":"GB", | ||
"New York":null | ||
} | ||
} | ||
### | ||
|
||
GET https://localhost:5001/Sample/ReadJsonPatchAsync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,31 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using ConsoleAppLibrary; | ||
using LaDeak.JsonMergePatch.Abstractions; | ||
using LaDeak.JsonMergePatch.Abstractions; | ||
using LaDeak.JsonMergePatch.Http; | ||
|
||
namespace ReadJsonPatchAsync | ||
namespace ReadJsonPatchAsync; | ||
|
||
public class Program | ||
{ | ||
public class Program | ||
[Patchable] | ||
public class WeatherForecast | ||
{ | ||
public class WeatherForecast | ||
{ | ||
public DateTime Date { get; set; } | ||
public int Temp { get; set; } | ||
public string Summary { get; set; } | ||
} | ||
|
||
public static async Task Main(string[] args) | ||
{ | ||
LaDeak.JsonMergePatch.Abstractions.JsonMergePatchOptions.Repository = LaDeak.JsonMergePatch.Generated.SafeConsoleApp.TypeRepository.Instance.Extend(LaDeak.JsonMergePatch.Generated.SafeConsoleAppLibrary.TypeRepository.Instance); | ||
await ReadAsJsonMergePatchAsync(); | ||
} | ||
public DateTime Date { get; set; } | ||
public int Temp { get; set; } | ||
public string Summary { get; set; } | ||
} | ||
|
||
public static async Task ReadAsJsonMergePatchAsync() | ||
{ | ||
var httpClient = new HttpClient(); | ||
var response = await httpClient.GetAsync("https://localhost:5001/Sample/Weather", HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); | ||
var responseData = await response.Content.ReadJsonPatchAsync<WeatherForecast>().ConfigureAwait(false); | ||
var target = new WeatherForecast() { Date = DateTime.UtcNow, Summary = "Sample weather forecast", Temp = 24 }; | ||
var result = responseData.ApplyPatch(target); | ||
Console.WriteLine($"Patched: Date={result.Date}, Summary={result.Summary}, Temp={result.Temp}"); | ||
public static async Task Main(string[] args) | ||
{ | ||
LaDeak.JsonMergePatch.Abstractions.JsonMergePatchOptions.Repository = LaDeak.JsonMergePatch.Generated.SafeConsoleApp.TypeRepository.Instance.Extend(LaDeak.JsonMergePatch.Generated.SafeConsoleAppLibrary.TypeRepository.Instance); | ||
await ReadAsJsonMergePatchAsync(); | ||
} | ||
|
||
var client = new Client(); | ||
await client.ReadAsJsonMergePatchAsync(); | ||
} | ||
public static async Task ReadAsJsonMergePatchAsync() | ||
{ | ||
var httpClient = new HttpClient(); | ||
var response = await httpClient.GetAsync("https://localhost:5001/Sample/Weather", HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); | ||
var responseData = await response.Content.ReadJsonPatchAsync<WeatherForecast>().ConfigureAwait(false); | ||
var target = new WeatherForecast() { Date = DateTime.UtcNow, Summary = "Sample weather forecast", Temp = 22 }; | ||
var result = responseData.ApplyPatch(target); | ||
Console.WriteLine($"Patched: Date={result.Date}, Summary={result.Summary}, Temp={result.Temp}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using LaDeak.JsonMergePatch.Abstractions; | ||
using LaDeak.JsonMergePatch.Http; | ||
|
||
namespace ConsoleAppLibrary | ||
namespace ConsoleAppLibrary; | ||
|
||
[Patchable] | ||
public class DeviceData | ||
{ | ||
public class DeviceData | ||
{ | ||
public double Watts { get; set; } | ||
public string Name { get; set; } | ||
} | ||
public double Watts { get; set; } | ||
public string Name { get; set; } | ||
} | ||
|
||
public class Client | ||
public class Client | ||
{ | ||
public async Task ReadAsJsonMergePatchAsync() | ||
{ | ||
public async Task ReadAsJsonMergePatchAsync() | ||
{ | ||
var httpClient = new HttpClient(); | ||
var response = await httpClient.GetAsync("https://localhost:5001/Sample/DeviceData", HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); | ||
var responseData = await response.Content.ReadJsonPatchAsync<DeviceData>().ConfigureAwait(false); | ||
var target = new DeviceData() { Watts = 5, Name = "phone" }; | ||
var result = responseData.ApplyPatch(target); | ||
Console.WriteLine($"Patched: Name={result.Name}, Watts={result.Watts}"); | ||
} | ||
var httpClient = new HttpClient(); | ||
var response = await httpClient.GetAsync("https://localhost:5001/Sample/DeviceData", HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); | ||
var responseData = await response.Content.ReadJsonPatchAsync<DeviceData>().ConfigureAwait(false); | ||
var target = new DeviceData() { Watts = 5, Name = "phone" }; | ||
var result = responseData.ApplyPatch(target); | ||
Console.WriteLine($"Patched: Name={result.Name}, Watts={result.Watts}"); | ||
} | ||
} |
Oops, something went wrong.