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 10
10
namespace TestServer . Controllers . Api . v1 ;
11
11
12
12
[ Post ( "/api/v1/testIn" ) ]
13
- public class TestInController : AsyncController < MultipartViewModel >
13
+ public class TestInController : Controller2 < MultipartViewModel >
14
14
{
15
- public override async Task < ControllerResponse > Invoke ( )
15
+ public async Task < ControllerResponse > Invoke ( )
16
16
{
17
17
var file = Model . Files . FirstOrDefault ( ) ?? throw new ArgumentException ( "No files in model" ) ;
18
18
using var stream = new StreamReader ( file . Data ) ;
Original file line number Diff line number Diff line change 4
4
namespace TestServer . Controllers ;
5
5
6
6
[ Get ( "status" ) ]
7
- public class StatusController : Controller
7
+ public class StatusController : Controller2
8
8
{
9
- public override ControllerResponse Invoke ( ) => Content ( "Service is running!" ) ;
9
+ public ControllerResponse Invoke ( ) => Content ( "Service is running!" ) ;
10
10
}
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 ;
3
7
4
- namespace TestServer ;
8
+ DIContainer . Current
9
+ . RegisterAll ( )
10
+ . Verify ( ) ;
5
11
6
- public class Program
7
- {
8
- public static void Main ( string [ ] args ) => CreateWebHostBuilder ( args ) . Build ( ) . Run ( ) ;
12
+ HttpModelHandler . RegisterModelBinder < HttpMultipartFormModelBinder > ( ) ;
9
13
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 1
1
using Simplify . DI ;
2
+ using Simplify . Web ;
2
3
using Simplify . Web . Multipart ;
3
4
4
5
namespace TestServer . Setup ;
5
6
6
7
public static class IocRegistrations
7
8
{
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
+ }
9
16
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments