File tree Expand file tree Collapse file tree 5 files changed +29
-42
lines changed Expand file tree Collapse file tree 5 files changed +29
-42
lines changed Original file line number Diff line number Diff line change 1010namespace TestServer . Controllers . Api . v1 ;
1111
1212[ Post ( "/api/v1/testIn" ) ]
13- public class TestInController : AsyncController < MultipartViewModel >
13+ public class TestInController : Controller2 < MultipartViewModel >
1414{
15- public override async Task < ControllerResponse > Invoke ( )
15+ public async Task < ControllerResponse > Invoke ( )
1616 {
1717 var file = Model . Files . FirstOrDefault ( ) ?? throw new ArgumentException ( "No files in model" ) ;
1818 using var stream = new StreamReader ( file . Data ) ;
Original file line number Diff line number Diff line change 44namespace TestServer . Controllers ;
55
66[ Get ( "status" ) ]
7- public class StatusController : Controller
7+ public class StatusController : Controller2
88{
9- public override ControllerResponse Invoke ( ) => Content ( "Service is running!" ) ;
9+ public ControllerResponse Invoke ( ) => Content ( "Service is running!" ) ;
1010}
Original file line number Diff line number Diff line change 1- using Microsoft . AspNetCore ;
2- using Microsoft . AspNetCore . Hosting ;
1+ using Microsoft . AspNetCore . Builder ;
2+ using Simplify . DI ;
3+ using Simplify . Web ;
4+ using Simplify . Web . Model ;
5+ using Simplify . Web . Multipart . Model . Binding ;
6+ using TestServer . Setup ;
37
4- namespace TestServer ;
8+ DIContainer . Current
9+ . RegisterAll ( )
10+ . Verify ( ) ;
511
6- public class Program
7- {
8- public static void Main ( string [ ] args ) => CreateWebHostBuilder ( args ) . Build ( ) . Run ( ) ;
12+ HttpModelHandler . RegisterModelBinder < HttpMultipartFormModelBinder > ( ) ;
913
10- public static IWebHostBuilder CreateWebHostBuilder ( string [ ] args ) =>
11- WebHost . CreateDefaultBuilder ( args )
12- . UseStartup < Startup > ( ) ;
13- }
14+ var builder = WebApplication . CreateBuilder ( args ) ;
15+
16+ var app = builder . Build ( ) ;
17+
18+ app . UseSimplifyWeb ( ) ;
19+
20+ await app . RunAsync ( ) ;
Original file line number Diff line number Diff line change 11using Simplify . DI ;
2+ using Simplify . Web ;
23using Simplify . Web . Multipart ;
34
45namespace TestServer . Setup ;
56
67public static class IocRegistrations
78{
8- public static void Register ( ) => DIContainer . Current . RegisterHttpMultipartFormModelBinder ( ) ;
9+ public static IDIContainerProvider RegisterAll ( this IDIContainerProvider provider )
10+ {
11+ provider . RegisterHttpMultipartFormModelBinder ( )
12+ . RegisterSimplifyWeb ( ) ;
13+
14+ return provider ;
15+ }
916}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments