zoukankan      html  css  js  c++  java
  • 管道式的开发模式

    主要是业务像面条一样的,一条下来。前面有人说尽量不要用throw Exception代替业务流,在高并的系统上,

    所以新系统的接口基本被定义成 (bool,参数0,参数1.....) = await getdata(.....) C#7的新语法,

    对于我这样的菜鸟来讲,问题就来了。很容易把几个await返回的参数搞混乱。

    突然发现,管道式的方式很合适这种业务调用。

    例如:

    var dobi =(参数0.....参数1).Step(async a =>

    (bool,参数0,参数1.....) = await getdata(.....) 

    if(bool == false){

    return (false,"有误",....)

    }

    }).Step(async a =>

    {

    if(a.Item1 == false){

    ....

    }

    (bool,参数0,参数1.....) = await getdata(a,xxx,b.yyy) 

    if(bool == false){

    return (false,"有误",....)

    });

    if(dobi.xxx){

    return Ok("成功");

    }

    return Ok(dobi.errorinfo);

  • 相关阅读:
    event.currentTarget
    architecture 20190628
    jQuery extend
    Prototype js library
    this._super()
    cdn for js library
    WAMPSERVER php
    characteristics of competent communicators
    onchange and oninput
    jQuery .ready()
  • 原文地址:https://www.cnblogs.com/forhell/p/14219961.html
Copyright © 2011-2022 走看看