Advertisement

精通ASP.NET Web API - Mastering ASP.NET Web API,由Packt出版

  •  5星
  •     浏览量: 0
  •     大小:None
  •      文件类型:None


简介:
本书《精通ASP.NET Web API》深入浅出地讲解了如何使用ASP.NET Web API构建高效、可扩展的Web应用程序,适合有一定基础的开发者阅读和参考。由知名技术出版社Packt出版。 掌握ASP.NET Web API 这是发行的代码存储库的一部分内容,其中包含了完成本书所需的所有支持项目文件。这本书讲述了如何使用ASP.NET Core创新地构建Web API的方法。通过阅读此书,您将学习到ASP.NET Core的基础知识,并且会探索中间件的概念、与数据库集成的方式以及应用各种安全机制等技能,同时还将学会在流行的Web UI框架中创建和利用这些API。 本书适合不同经验水平的开发人员:无论是有开发Web API的经验还是新入门者都可以从中受益。虽然具有先前的知识会有帮助,但这并不是必需的前提条件。它将指导您构建真正的跨平台ASP.NET Core Web API,并且让您掌握它的使用方法。 在撰写此书时,我们采用了 .NET Core 2.0 Preview 2 和 ASP.NET Core 2.0 Preview 2 版本的工具和技术,包括 Visual Studio 2017 Preview 3。我们的目标是随着ASP.NET Core的发展持续更新本书的内容。

全部评论 (0)

还没有任何评论哟~
客服
客服
  • ASP.NET Web API - Mastering ASP.NET Web APIPackt
    优质
    本书《精通ASP.NET Web API》深入浅出地讲解了如何使用ASP.NET Web API构建高效、可扩展的Web应用程序,适合有一定基础的开发者阅读和参考。由知名技术出版社Packt出版。 掌握ASP.NET Web API 这是发行的代码存储库的一部分内容,其中包含了完成本书所需的所有支持项目文件。这本书讲述了如何使用ASP.NET Core创新地构建Web API的方法。通过阅读此书,您将学习到ASP.NET Core的基础知识,并且会探索中间件的概念、与数据库集成的方式以及应用各种安全机制等技能,同时还将学会在流行的Web UI框架中创建和利用这些API。 本书适合不同经验水平的开发人员:无论是有开发Web API的经验还是新入门者都可以从中受益。虽然具有先前的知识会有帮助,但这并不是必需的前提条件。它将指导您构建真正的跨平台ASP.NET Core Web API,并且让您掌握它的使用方法。 在撰写此书时,我们采用了 .NET Core 2.0 Preview 2 和 ASP.NET Core 2.0 Preview 2 版本的工具和技术,包括 Visual Studio 2017 Preview 3。我们的目标是随着ASP.NET Core的发展持续更新本书的内容。
  • ASP.NET Web API 示例
    优质
    ASP.NET Web API示例展示了如何使用ASP.NET框架创建和配置RESTful服务,包括控制器、路由设置以及数据操作方法。 ASP.NET Web API 实例包括了:更改默认路由表方法名字的 HttpMethod 以及 ActionName 的注解属性、基本的实体框架入门知识,还有调用API的示例代码。
  • ASP.NET Web API 2 第2.pdf
    优质
    《ASP.NET Web API 2 第2版》详细介绍了如何使用ASP.NET Web API 2构建高效、可扩展且安全的Web应用程序。本书深入浅出地讲解了RESTful服务开发的最佳实践,帮助开发者快速掌握关键技术和设计模式。 About the Authors xiii About the Technical Reviewer xv Acknowledgments xvii Foreword xix Introduction xxi Chapter 1: ASP.NET as a Service Framework 1 Chapter 2: What Is RESTful 9 Chapter 3: Designing the Sample REST API 21 Chapter 4: Building the Environment and Creating the Source Tree 31 Chapter 5: Up and Down the Stack with a POST 49 Chapter 6: Securing the Service 117 Chapter 7: Dealing with Relationships, Partial Updates, and Other Complexities 157 Chapter 8: Supporting Diverse Clients 209 Chapter 9: Completing the Picture 221 Index
  • ASP.NET Web API 2 第二.pdf
    优质
    《ASP.NET Web API 2 第二版》详细介绍了如何使用ASP.NET框架开发RESTful服务,适合希望构建高效、可扩展Web应用程序的开发者阅读。 About the Authors xiii About the Technical Reviewer xv Acknowledgments xvii Foreword xix Introduction xxi Chapter 1: ASP.NET as a Service Framework 1 Chapter 2: What Is RESTful 9 Chapter 3: Designing the Sample REST API 21 Chapter 4: Building the Environment and Creating the Source Tree 31 Chapter 5: Up and Down the Stack with a POST 49 Chapter 6: Securing the Service 117 Chapter 7: Dealing with Relationships, Partial Updates, and Other Complexities 157 Chapter 8: Supporting Diverse Clients 209 Chapter 9: Completing the Picture 221 Index
  • ASP.NET Web API Swagger安装示例
    优质
    本示例详细介绍如何在ASP.NET Web API项目中安装和配置Swagger工具,实现API文档自动生成与交互测试。 C# ASP.NET Web Api 使用 Swagger 的安装与配置示例已制作完成,供参考使用。如发现有任何不当之处,请大家指出。
  • ASP.NET Web API的设计与开发
    优质
    《ASP.NET Web API的设计与开发》一书深入浅出地介绍了如何使用ASP.NET框架创建高效、可维护的Web服务。适合有一定基础的开发者进阶学习。 《ASP.NET Web API设计布洛克》原版PDF扫描版非常适合新手以及开发人员参考学习。
  • ASP.NET Web API 文件上传接收
    优质
    本文章介绍了如何在ASP.NET Web API中实现文件上传功能,包括客户端和服务器端的配置及代码示例。 ASP.NET Web API 文件上传及 multipart MIME 处理主要涉及如何在Web API项目中实现文件的接收与处理功能。multipart MIME是一种用于发送包含多个部分的消息格式,通常用来传输表单数据以及附件文件等信息。在开发过程中,我们需要配置好相关的MVC或Web API设置以支持这类请求,并确保正确解析上传的文件内容以便后续使用或者存储。
  • ASP.NET Core 6 Web API 实例演示
    优质
    本实例详细讲解了如何使用ASP.NET Core 6构建一个Web API应用,并通过实际案例进行功能演示和代码实现。适合初学者快速上手学习。 本段落将介绍如何使用ASP.NET Core 6.0 和 Entity Framework Core 构建RESTful Web API。 首先需要安装 ASP.NET Core SDK,并创建一个新的 ASP.NET Core Web API项目。在解决方案资源管理器中,右键单击“依赖项”文件夹并选择添加>NuGet包,然后搜索和安装 `Microsoft.EntityFrameworkCore` 及其相关的数据库提供程序(如 SQL Server 或 SQLite)。 接下来,在 Models 文件夹下创建数据模型类,并使用 EF Core 的代码优先功能定义实体。例如: ```csharp public class Product { public int Id { get; set; } public string Name { get; set; } = ; public decimal Price { get; set; } } ``` 然后,需要在项目中添加一个 `DbContext` 类来管理数据库的访问和操作。例如: ```csharp public class ApplicationDbContext : DbContext { public DbSet Products { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseSqlServer(YourConnectionStringHere); } ``` 在Controllers文件夹中创建一个名为ProductsController的控制器类,继承自 ControllerBase,并使用 [ApiController] 和 [Route([controller])] 属性来定义 RESTful API 的行为和路由。例如: ```csharp [ApiController] [Route([controller])] public class ProductsController : ControllerBase { private readonly ApplicationDbContext _context; public ProductsController(ApplicationDbContext context) => _context = context; // GET: products [HttpGet] public async Task>> GetProducts() { return await _context.Products.ToListAsync(); } // GET: products/{id} [HttpGet({id})] public async Task> GetProduct(int id) { var product = await _context.Products.FindAsync(id); if (product == null) return NotFound(); return product; } // POST: products [HttpPost] public async Task> Post(Product product) { _context.Products.Add(product); await _context.SaveChangesAsync(); return CreatedAtAction(nameof(GetProduct), new { id = product.Id }, product); } // PUT: products/{id} [HttpPut({id})] public async Task Put(int id, Product product) { if (id != product.Id) return BadRequest(); _context.Entry(product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch(DbUpdateConcurrencyException) { if(!await ProductExists(id)) return NotFound(); throw; } return NoContent(); } // DELETE: products/{id} [HttpDelete({id})] public async Task Delete(int id) { var product = await _context.Products.FindAsync(id); if (product == null) return NotFound(); _context.Products.Remove(product); await _context.SaveChangesAsync(); return NoContent(); } private bool ProductExists(int id) => _context.Products.Any(e => e.Id == id); } ``` 最后,需要配置依赖注入以确保在应用程序启动时创建 `ApplicationDbContext` 实例,并将其传递给控制器。这可以在项目的 Startup.cs 文件中完成: ```csharp public void ConfigureServices(IServiceCollection services) { services.AddControllers(); // 添加 EF Core 服务 services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString(DefaultConnection))); } ``` 至此,就完成了使用 ASP.NET Core 6.0 和 Entity Framework Core 构建 RESTful Web API 的基本步骤。
  • 用C#创建你的首个ASP.NET Web API
    优质
    本教程将引导初学者使用C#语言构建第一个ASP.NET Web API项目,涵盖基础概念和实战技巧。 在ASP.NET MVC 4中,微软增加了对Web API的支持,并且Entity Framework是一个轻量级的ORM框架。如何结合使用这两者来构建网站项目呢?本教程将指导你逐步建立一个商城应用,在这个过程中你会对Web API、ASP.NET MVC 4和Entity Framework有一个初步的认识,这是一份非常适合初学者的学习资料。