本案例主要说明如何使用NSwag 工具使用桌面工具快速生成c# 客户端代码、快速的访问Web Api。

NSwagStudio 下载地址 比较强大、可以生成TypeScript、WebApi Controller、CSharp Client 

1、运行WebApi项目  URL http://yourserver/swagger 然后你将看到界面如下

NSwagStudio  for Swagger Api

    1.1 Web API 代码

    该代码使用的是Abp框架、如果不了解Abp框架的请到官网 http://www.aspnetboilerplate.com/ 了解

  •  实休代码
       public class UserInformation : Entity<int>, IHasCreationTime, IHasModificationTime
        {
            [StringLength(20)]
            public string UserName { get; set; }
            public int UserAge { get; set; }
            [StringLength(20)]
            public string UserAddress { get; set; }
    
            public UserInformation()
            {
                CreationTime = Clock.Now;
            }
            public DateTime CreationTime { get; set; }
            public DateTime? LastModificationTime { get; set; }
        }
    实体代码

相关文章:

  • 2022-01-05
  • 2022-12-23
  • 2022-03-09
  • 2021-12-18
  • 2021-12-05
  • 2021-11-17
  • 2022-02-19
  • 2021-12-12
猜你喜欢
  • 2021-08-23
  • 2022-12-23
  • 2021-10-29
  • 2021-09-21
  • 2021-07-16
  • 2022-01-17
  • 2022-02-23
相关资源
相似解决方案