aot发布支持
This commit is contained in:
		
							parent
							
								
									ef4ebf738a
								
							
						
					
					
						commit
						bd70867481
					
				| @ -1,6 +1,7 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| using System.Diagnostics.CodeAnalysis; | ||||
| using System.Globalization; | ||||
| 
 | ||||
| namespace FastGithub.Configuration | ||||
| @ -18,7 +19,7 @@ namespace FastGithub.Configuration | ||||
|         /// <typeparam name="T"></typeparam> | ||||
|         /// <param name="reader"></param> | ||||
|         /// <param name="writer"></param> | ||||
|         public static void Bind<T>(Func<string, T?> reader, Func<T?, string?> writer) | ||||
|         public static void Bind<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(Func<string, T?> reader, Func<T?, string?> writer) | ||||
|         { | ||||
|             binders[typeof(T)] = new Binder<T>(reader, writer); | ||||
| 
 | ||||
| @ -37,7 +38,7 @@ namespace FastGithub.Configuration | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         private class Binder<T> : Binder | ||||
|         private class Binder<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T> : Binder | ||||
|         { | ||||
|             private readonly Func<string, T?> reader; | ||||
|             private readonly Func<T?, string?> writer; | ||||
| @ -60,7 +61,7 @@ namespace FastGithub.Configuration | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|         private class TypeConverter<T> : TypeConverter | ||||
|         private class TypeConverter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T> : TypeConverter | ||||
|         { | ||||
|             public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) | ||||
|             { | ||||
|  | ||||
							
								
								
									
										9
									
								
								FastGithub.FlowAnalyze/FlowStatisticsContext.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								FastGithub.FlowAnalyze/FlowStatisticsContext.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| using System.Text.Json.Serialization; | ||||
| 
 | ||||
| namespace FastGithub.FlowAnalyze | ||||
| { | ||||
|     [JsonSerializable(typeof(FlowStatistics))] | ||||
|     public partial class FlowStatisticsContext : JsonSerializerContext | ||||
|     { | ||||
|     } | ||||
| } | ||||
| @ -3,16 +3,16 @@ | ||||
|     /// <summary> | ||||
|     /// app选项 | ||||
|     /// </summary> | ||||
|     public class AppOptions | ||||
|     public record AppOptions | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// 父进程id | ||||
|         /// </summary> | ||||
|         public int ParentProcessId { get; set; } | ||||
|         public int ParentProcessId { get; init; } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// udp日志服务器端口 | ||||
|         /// </summary> | ||||
|         public int UdpLoggerPort { get; set; } | ||||
|         public int UdpLoggerPort { get; init; } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -9,8 +9,11 @@ using Microsoft.Extensions.Hosting; | ||||
| using Serilog; | ||||
| using Serilog.Sinks.Network; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Diagnostics.CodeAnalysis; | ||||
| using System.IO; | ||||
| using System.Net; | ||||
| using System.Text.Json; | ||||
| 
 | ||||
| namespace FastGithub | ||||
| { | ||||
| @ -87,6 +90,7 @@ namespace FastGithub | ||||
|         /// ÅäÖ÷þÎñ | ||||
|         /// </summary> | ||||
|         /// <param name="builder"></param> | ||||
|         [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Dictionary<string, DomainConfig>))] | ||||
|         public static void ConfigureServices(this WebApplicationBuilder builder) | ||||
|         { | ||||
|             var services = builder.Services; | ||||
| @ -124,7 +128,8 @@ namespace FastGithub | ||||
|             app.MapGet("/flowStatistics", context => | ||||
|             { | ||||
|                 var flowStatistics = context.RequestServices.GetRequiredService<IFlowAnalyzer>().GetFlowStatistics(); | ||||
|                 return context.Response.WriteAsJsonAsync(flowStatistics); | ||||
|                 var json = JsonSerializer.Serialize(flowStatistics, FlowStatisticsContext.Default.FlowStatistics); | ||||
|                 return context.Response.WriteAsync(json); | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user