Giter Club home page Giter Club logo

requestmapper's Introduction

RequestMapper

通过注解自动映射到实例的类库,适用于请求结构复杂,传统的参数注解无法映射的情况

Effect

Start

  • 在需要映射的模型上添加注解,内置提供了一部分,他们在命名空间 Feast.RequestMapper.Attribute

    [FromQuery]
    public class Model 
    {
        public string Id { get; set; }
        public string? Name { get; init; }
    
        [FromForm]
        public IFormFile Logo { get; init; }
        [FromForm]
        public IReadOnlyList<IFormFile> Pictures { get; init; }
    }

    class 上添加的注解会自动应用到全部的 property ,在 property 上添加的注解会优先于 class 上的注解

  • 如果需要使用自定义注解或者内置注解,可以通过注册

    RequestMapper.RegisterAttribute<YourAttribute>(Registry.AsYourWish);
  • 通过请求的报文来生成

    var model = new Model();
    var newModel = RequestMappper.Generate(this.Request);
    model.Map(this.Request);

Preview

  • 🚧 映射处理系统(真的需要吗)

requestmapper's People

Contributors

feast107 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.