服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-04-12 646ce5990fb03908a0371fc4ca8416905b27a4d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Rhea.Common;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using Tiger.IBusiness;
 
namespace Tiger.Api.Controllers.Test
{
    [Route("api/[controller]")]
    public class ValuesController : Controller
    {
        private Stopwatch Stopwatch { get; set; }
 
        [HttpGet("testlog")]
        public string TestLog()
        {
            Stopwatch = new Stopwatch();
            Stopwatch.Start();
            for (int i = 0; i < 100; i++)
            {
                Logger.Default.Info("Test"+1);
            }
            Stopwatch.Stop();
            return Stopwatch.Elapsed.TotalMilliseconds.ToString();
        }
 
        // GET: api/values
        [HttpGet]
        public string Get()
        {
            //Logger.Default.Setting("");
            Stopwatch = new Stopwatch();
            Stopwatch.Start();
            for (int i = 0; i < 100; i++)
            {
                Logger.Default.Info("TestDefault"+i);
            }
            Stopwatch.Stop();
            return Stopwatch.Elapsed.TotalMilliseconds.ToString();
        }
 
        // GET api/values/5
        [HttpGet("{id}")]
        public string Get(int id)
        {
            return "value";
        }
 
        // POST api/values
        [HttpPost]
        public void Post([FromBody]string param)
        {
            return;
        }
 
        // PUT api/values/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody]string value)
        {
        }
 
        // DELETE api/values/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }
}