Migration guide from SimpleW v16
Notes
Consider the v26 = v2 like the v16 = v1.
Even if some high level classes/methods has been renamed, your understanding of their role remains quite the same and the bump version should not be a pain.
For example, I've migrated a full project (thirty controllers / four hundred methods) on a couple of hours :
- 1h : 90% of searches and replaces (mostly Request and Response syntax change)
- 1h : 10% of real things to rewrite/adapt (SimpleWServer options, CORS, WebSockets, Telemetry)
If you have issue with the migration, ping me on Discord and I'll try to look at it.
You can stay in v16, but I will never update/fix that one. The v26 is the new better way to go, and a smart move for a long run.
Code breaking change
How to replace old class/method/property with the new one.
Core
SimpleWServer.Start()=>SimpleWServer.StartAsync()orSimpleWServer.RunAsync()depending on the blocking context you wantSimpleWServer.Stop()=>SimpleWServer.StopAsync()SimpleWSServer=>SimpleWServer.UseHttps()to setup ssl certificateSimpleWServer.AddDynamicContent()=>SimpleWServer.MapControllers()andSimpleWServer.MapController()SimpleWServer.AddStaticContent()=>SimpleWServer.UseStaticFilesModule()SimpleWServer.AddCORS()=>SimpleWServer.UseCorsModule()SimpleWServer.EnableTelemetry=>SimpleWServer.EnableTelemetry()andSimpleWServer.DisableTelemetry()
Request
Request.Header()=>Request.Headers.*orRequest.Headers.TryGetValue("name", out string value)
Response
Response.MakeResponse()depending on the context, build you response withResponse.Text(),Response.Body()...Response.MakeUnAuthorizedResponse()=>Response.UnAuthorized()Response.MakeForbiddenResponse()=>Response.Forbidden()Response.MakeInternalServerErrorResponse()=>Response.InternalServerError()Response.MakeNotFoundResponse()=>Response.NotFound()Response.MakeRedirectResponse()=>Response.Redirect()Response.MakeAccessResponse()=>Response.Access()Response.MakeDownloadResponse()=> depending on the contextResponse.Text()orResponse.Body()and thenResponse.Body().Attachment(outputFilename).
Controller
webuser=>User
Extensions
NetCoreServerExtension=>SimpleWExtensionNetCoreServerExtension.CreateJwt()=>Session.CreateJwt()
Removed
- All the statistics properties from
SimpleWServerclass (ConnectedSessions,BytesPending,BytesSent,BytesReceived) has been removed. They may be appears is a future release but not now. SimpleWServer.OptionSendBufferSizeproperty no longer exists;SimpleWServer.TrustXHeadersproperty no longer exists (seeSimpleWServer.ConfigureTelemetry()on how to add custom telemetry tags);
