外观模式(Façade Pattern)

概述

在软件开发系统中,客户程序经常会与复杂系统的内部子系统之间产生耦合,而导致客户程序随着子系统的变化而变化。那么如何简化客户程序与子系统之间的交互接口?如何将复杂系统的内部子系统与客户程序之间的依赖解耦?这就是要说的Façade 模式。


意图

为子系统中的一组接口提供一个一致的界面,Facade模式定义了一个高层接口,这个接口使得这一子系统更加容易使用。[GOF 《设计模式》]

示意图

门面模式没有一个一般化的类图描述,下面是一个示意性的对象图:

图1 Façade模式示意性对象图

生活中的例子

外观模式为子系统中的接口定义了一个统一的更高层次的界面,以便于使用。当消费者按照目录采购时,则体现了一个外观模式。消费者拨打一个号码与客服代表联系,客服代表则扮演了这个"外观",他包含了与订货部、收银部和送货部的接口。

图2使用电话订货例子的外观模式对象图

Facade模式解说

我们平时的开发中其实已经不知不觉的在用Façade模式,现在来考虑这样一个抵押系统,当有一个客户来时,有如下几件事情需要确认:到银行子系统查询他是否有足够多的存款,到信用子系统查询他是否有良好的信用,到贷款子系统查询他有无贷款劣迹。只有这三个子系统都通过时才可进行抵押。我们先不考虑Façade模式,那么客户程序就要直接访问这些子系统,分别进行判断。类结构图下:

图3

在这个程序中,我们首先要有一个顾客类,它是一个纯数据类,并无任何操作,示意代码:

 

 

None.gif//顾客类
None.gifpublic classCustomer
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    private string _name;
InBlock.gif
InBlock.gif    public Customer(string name)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        this._name = name;
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    public string Name
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        get dot.gif{ return _name; }
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}


下面这三个类均是子系统类,示意代码:

None.gif//银行子系统
None.gifpublic classBank
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    public bool HasSufficientSavings(Customer c, int amount)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        Console.WriteLine("Check bank for " + c.Name);
InBlock.gif        return true;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
None.gif//信用子系统
None.gifpublic classCredit
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    public bool HasGoodCredit(Customer c)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        Console.WriteLine("Check credit for " + c.Name);
InBlock.gif        return true;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
None.gif//贷款子系统
None.gifpublic classLoan
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    public bool HasNoBadLoans(Customer c)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        Console.WriteLine("Check loans for " + c.Name);
InBlock.gif        return true;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}


来看客户程序的调用:

None.gif//客户程序
None.gifpublic classMainApp
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    private const int _amount = 12000;
InBlock.gif
InBlock.gif    public static void Main()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        Bank bank = new Bank();
InBlock.gif        Loan loan = new Loan();
InBlock.gif        Credit credit = new Credit();
InBlock.gif
InBlock.gif        Customer customer = new Customer("Ann McKinsey");
InBlock.gif
InBlock.gif        bool eligible = true;
InBlock.gif
InBlock.gif        if (!bank.HasSufficientSavings(customer, _amount))
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            eligible = false;
ExpandedSubBlockEnd.gif        }

InBlock.gif        else if (!loan.HasNoBadLoans(customer))
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            eligible = false;
ExpandedSubBlockEnd.gif        }

InBlock.gif        else if (!credit.HasGoodCredit(customer))
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            eligible = false;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        Console.WriteLine("\n" + customer.Name + " has been " + (eligible ? "Approved" : "Rejected"));
InBlock.gif        Console.ReadLine();
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}


可以看到,在不用Façade模式的情况下,客户程序与三个子系统都发生了耦合,这种耦合使得客户程序依赖于子系统,当子系统变化时,客户程序也将面临很多变化的挑战。一个合情合理的设计就是为这些子系统创建一个统一的接口,这个接口简化了客户程序的判断操作。看一下引入Façade模式后的类结构图:

图4

门面类Mortage的实现如下:

 

None.gif//外观类
None.gifpublic classMortgage
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    private Bank bank = new Bank();
InBlock.gif    private Loan loan = new Loan();
InBlock.gif    private Credit credit = new Credit();
InBlock.gif
InBlock.gif    public bool IsEligible(Customer cust, int amount)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        Console.WriteLine("{0} applies for {1:C} loan\n",
InBlock.gif          cust.Name, amount);
InBlock.gif
InBlock.gif        bool eligible = true;
InBlock.gif
InBlock.gif        if (!bank.HasSufficientSavings(cust, amount))
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            eligible = false;
ExpandedSubBlockEnd.gif        }

InBlock.gif        else if (!loan.HasNoBadLoans(cust))
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            eligible = false;
ExpandedSubBlockEnd.gif        }

InBlock.gif        else if (!credit.HasGoodCredit(cust))
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            eligible = false;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        return eligible;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}


顾客类和子系统类的实现仍然如下:

 

None.gif//银行子系统
None.gifpublic classBank
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    public bool HasSufficientSavings(Customer c, int amount)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        Console.WriteLine("Check bank for " + c.Name);
InBlock.gif        return true;
ExpandedSubBlockEnd.gif    }
ExpandedBlockEnd.gif}
None.gif
None.gif//信用证子系统
None.gifpublic classCredit
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    public bool HasGoodCredit(Customer c)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        Console.WriteLine("Check credit for " + c.Name);
InBlock.gif        return true;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
None.gif//贷款子系统
None.gifpublic classLoan
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    public bool HasNoBadLoans(Customer c)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        Console.WriteLine("Check loans for " + c.Name);
InBlock.gif        return true;
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
None.gif//顾客类
None.gifpublic classCustomer
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    private string name;
InBlock.gif
InBlock.gif    public Customer(string name)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        this.name = name;
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    public string Name
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        get dot.gif{ return name; }
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}


而此时客户程序的实现:

None.gif//客户程序类
None.gifpublic classMainApp
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    public static void Main()
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        //外观
InBlock.gif        Mortgage mortgage = new Mortgage();
InBlock.gif
InBlock.gif        Customer customer = new Customer("Ann McKinsey");
InBlock.gif        bool eligable = mortgage.IsEligible(customer, 125000);
InBlock.gif
InBlock.gif        Console.WriteLine("\n" + customer.Name +
InBlock.gif            " has been " + (eligable ? "Approved" : "Rejected")); 
InBlock.gif        Console.ReadLine();
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}


可以看到引入Façade模式后,客户程序只与Mortgage发生依赖,也就是Mortgage屏蔽了子系统之间的复杂的操作,达到了解耦内部子系统与客户程序之间的依赖。

.NET架构中的Façade模式

Façade模式在实际开发中最多的运用当属开发N层架构的应用程序了,一个典型的N层结构如下:

图5

在这个架构中,总共分为四个逻辑层,分别为:用户层UI,业务外观层Business Façade,业务规则层Business Rule,数据访问层Data Access。其中Business Façade层的职责如下:

l         从“用户”层接收用户输入

l         如果请求需要对数据进行只读访问,则可能使用“数据访问”层

l         将请求传递到“业务规则”层

l         将响应从“业务规则”层返回到“用户”层

l         在对“业务规则”层的调用之间维护临时状态

对这一架构最好的体现就是Duwamish示例了。在该应用程序中,有部分操作只是简单的从数据库根据条件提取数据,不需要经过任何处理,而直接将数据显示到网页上,比如查询某类别的图书列表。而另外一些操作,比如计算定单中图书的总价并根据顾客的级别计算回扣等等,这部分往往有许多不同的功能的类,操作起来也比较复杂。如果采用传统的三层结构,这些商业逻辑一般是会放在中间层,那么对内部的这些大量种类繁多,使用方法也各异的不同的类的调用任务,就完全落到了表示层。这样势必会增加表示层的代码量,将表示层的任务复杂化,和表示层只负责接受用户的输入并返回结果的任务不太相称,并增加了层与层之间的耦合程度。于是就引入了一个Façade层,让这个Facade来负责管理系统内部类的调用,并为表示层提供了一个单一而简单的接口。看一下Duwamish结构图:

图6

从图中可以看到,UI层将请求发送给业务外观层,业务外观层对请求进行初步的处理,判断是否需要调用业务规则层,还是直接调用数据访问层获取数据。最后由数据访问层访问数据库并按照来时的步骤返回结果到UI层,来看具体的代码实现。

在获取商品目录的时候,Web UI调用业务外观层:

 

 

None.gifproductSystem = newProductSystem();
None.gifcategorySet   =productSystem.GetCategories(categoryID);


业务外观层直接调用了数据访问层:

None.gifpublicCategoryData GetCategories(intcategoryId)
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    //
InBlock.gif    // Check preconditions
InBlock.gif    //
InBlock.gif    ApplicationAssert.CheckCondition(categoryId >= 0,"Invalid Category Id",ApplicationAssert.LineNumber);
InBlock.gif    //
InBlock.gif    // Retrieve the data
InBlock.gif    //
InBlock.gif    using (Categories accessCategories = new Categories())
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        return accessCategories.GetCategories(categoryId);
ExpandedSubBlockEnd.gif    }

InBlock.gif    
ExpandedBlockEnd.gif}


在添加订单时,UI调用业务外观层:

None.gifpublic voidAddOrder()
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    ApplicationAssert.CheckCondition(cartOrderData != null, "Order requires data", ApplicationAssert.LineNumber);
InBlock.gif
InBlock.gif    //Write trace log.
InBlock.gif    ApplicationLog.WriteTrace("Duwamish7.Web.Cart.AddOrder:\r\nCustomerId: " +
InBlock.gif                                cartOrderData.Tables[OrderData.CUSTOMER_TABLE].Rows[0][OrderData.PKID_FIELD].ToString());
InBlock.gif    cartOrderData = (new OrderSystem()).AddOrder(cartOrderData);
ExpandedBlockEnd.gif}


业务外观层调用业务规则层:

 

None.gifpublicOrderData AddOrder(OrderData order)
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif    //
InBlock.gif    // Check preconditions
InBlock.gif    //
InBlock.gif    ApplicationAssert.CheckCondition(order != null, "Order is required", ApplicationAssert.LineNumber);
InBlock.gif    
InBlock.gif    (new BusinessRules.Order()).InsertOrder(order);
InBlock.gif    return order;
ExpandedBlockEnd.gif}


业务规则层进行复杂的逻辑处理后,再调用数据访问层:

None.gifpublic boolInsertOrder(OrderData order)
ExpandedBlockStart.gifContractedBlock.gifdot.gif{    
InBlock.gif    //
InBlock.gif    // Assume it's good
InBlock.gif    //
InBlock.gif    bool isValid = true;
InBlock.gif    //            
InBlock.gif    // Validate order summary
InBlock.gif    //
InBlock.gif    DataRow summaryRow = order.Tables[OrderData.ORDER_SUMMARY_TABLE].Rows[0];
InBlock.gif    
InBlock.gif    summaryRow.ClearErrors();
InBlock.gif
InBlock.gif    if (CalculateShipping(order) != (Decimal)(summaryRow[OrderData.SHIPPING_HANDLING_FIELD]))
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        summaryRow.SetColumnError(OrderData.SHIPPING_HANDLING_FIELD, OrderData.INVALID_FIELD);
InBlock.gif        isValid = false;
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    if (CalculateTax(order) != (Decimal)(summaryRow[OrderData.TAX_FIELD]))
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        summaryRow.SetColumnError(OrderData.TAX_FIELD, OrderData.INVALID_FIELD);
InBlock.gif        isValid = false;
ExpandedSubBlockEnd.gif    }

InBlock.gif    //    
InBlock.gif    // Validate shipping info
InBlock.gif    //
InBlock.gif    isValid &= IsValidField(order, OrderData.SHIPPING_ADDRESS_TABLE, OrderData.SHIP_TO_NAME_FIELD, 40);
InBlock.gif    //
InBlock.gif    // Validate payment info 
InBlock.gif    //
InBlock.gif    DataRow paymentRow = order.Tables[OrderData.PAYMENT_TABLE].Rows[0];
InBlock.gif    
InBlock.gif    paymentRow.ClearErrors();
InBlock.gif    
InBlock.gif    isValid &= IsValidField(paymentRow, OrderData.CREDIT_CARD_TYPE_FIELD, 40);
InBlock.gif    isValid &= IsValidField(paymentRow, OrderData.CREDIT_CARD_NUMBER_FIELD,  32);
InBlock.gif    isValid &= IsValidField(paymentRow, OrderData.EXPIRATION_DATE_FIELD, 30);
InBlock.gif    isValid &= IsValidField(paymentRow, OrderData.NAME_ON_CARD_FIELD, 40);
InBlock.gif    isValid &= IsValidField(paymentRow, OrderData.BILLING_ADDRESS_FIELD, 255);
InBlock.gif    //
InBlock.gif    // Validate the order items and recalculate the subtotal
InBlock.gif    //
InBlock.gif    DataRowCollection itemRows = order.Tables[OrderData.ORDER_ITEMS_TABLE].Rows;
InBlock.gif    
InBlock.gif    Decimal subTotal = 0;
InBlock.gif    
InBlock.gif    foreach (DataRow itemRow in itemRows)
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        itemRow.ClearErrors();
InBlock.gif        
InBlock.gif        subTotal += (Decimal)(itemRow[OrderData.EXTENDED_FIELD]);
InBlock.gif        
InBlock.gif        if ((Decimal)(itemRow[OrderData.PRICE_FIELD]) <= 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            itemRow.SetColumnError(OrderData.PRICE_FIELD, OrderData.INVALID_FIELD);
InBlock.gif            isValid = false;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        if ((short)(itemRow[OrderData.QUANTITY_FIELD]) <= 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            itemRow.SetColumnError(OrderData.QUANTITY_FIELD, OrderData.INVALID_FIELD);
InBlock.gif            isValid = false;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    //
InBlock.gif    // Verify the subtotal
InBlock.gif    //
InBlock.gif    if (subTotal != (Decimal)(summaryRow[OrderData.SUB_TOTAL_FIELD]))
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        summaryRow.SetColumnError(OrderData.SUB_TOTAL_FIELD, OrderData.INVALID_FIELD);
InBlock.gif        isValid = false;
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    if ( isValid )
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif        using (DataAccess.Orders ordersDataAccess = new DataAccess.Orders())
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            return (ordersDataAccess.InsertOrderDetail(order)) > 0;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    else
InBlock.gif        return false;
ExpandedBlockEnd.gif}

[MSDN]

效果及实现要点

1.Façade模式对客户屏蔽了子系统组件,因而减少了客户处理的对象的数目并使得子系统使用起来更加方便。

2.Façade模式实现了子系统与客户之间的松耦合关系,而子系统内部的功能组件往往是紧耦合的。松耦合关系使得子系统的组件变化不会影响到它的客户。

3.如果应用需要,它并不限制它们使用子系统类。因此你可以在系统易用性与通用性之间选择。

适用性

1.为一个复杂子系统提供一个简单接口。

2.提高子系统的独立性。

3.在层次化结构中,可以使用Facade模式定义系统中每一层的入口。

总结

Façade模式注重的是简化接口,它更多的时候是从架构的层次去看整个系统,而并非单个类的层次。

转载于:https://www.cnblogs.com/whitetiger/archive/2007/03/31/694814.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/305666.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

WTM5.0发布,全面支持.net5

点击上方蓝字关注我们WTM5.0全面支持.net5WTM5.0是WTM框架开源2年以来最大的一次升级&#xff0c;全面支持.net5&#xff0c;大幅重构了底层代码&#xff0c;针对广大用户提出的封装过度&#xff0c;不够灵活&#xff0c;性能不高等问题进行了彻底的修改。这次升级使WTM继续保持…

rsa 模数 指数转换 c语言_模数转换,你必须知道的8个经典ADC转换电路方案

模数转换器即A/D转换器&#xff0c;或简称ADC&#xff0c;通常是指一个将模拟信号转变为数字信号的电子元件。通常的模数转换器是将一个输入电压信号转换为一个输出的数字信号。由于数字信号本身不具有实际意义&#xff0c;仅仅表示一个相对大小。故任何一个模数转换器都需要一…

C语言怎么提出大写字母,c语言函数toupper()如何将小写字母转换为大写字母

c语言函数toupper()如何将小写字母转换为大写字母&#xff1f;大小写字母怎么转换&#xff1f;函数需要引入的头文件&#xff1a;#include toupper()的定义&#xff1a;int toupper(int c);toupper()函数介绍&#xff1a;若参数 c 为小写字母则将该对应的大写字母返回。toupper…

生活的目标是什么

07-1-25长大了,生活没目标了.<?xml:namespace prefix o ns "urn:schemas-microsoft-com:office:office" />学生时代的我,总想着闯一番事业.期待着自己可以有敏锐的头脑,和不俗的思想.并且为了这个目标辛勤地努力着.我是一个会考试的机器人,擅长的只是追逐答…

linux定时关机命令_win10电脑定时关机命令

电脑定时关机命令可以帮助用户们很好的去设置电脑自动关机等&#xff0c;自己无需操作&#xff0c;电脑也会在对应的时间自动关机&#xff0c;使用起来还是非常方便的&#xff0c;现在就来看看电脑定时关机命令教程吧~电脑定时关机命令是什么&#xff1a;一、CMD设置关机1、点击…

为你的项目启用可空引用类型

为你的项目启用可空引用类型IntroC# 从 8.0 开始引入了可空引用类型&#xff0c;我们可以为项目启用可空引用类型来借助编译器来帮助我们更好的处理代码中的空引用的处理&#xff0c;可以避免我们写很多不必要 null 检查&#xff0c;提高我们的效率Why为什么我们要启用可空引用…

c语言配电自动化,我是电气工程及其自动化专业的要学C语言吗?

电气工程、控制科学与工程、计算机科学与技术 主要课程&#xff1a;电路理论、信息电子技术、电力电子技术、自动控制原理、微机原理与应用、电气工程基础、电机学、电器学、电力系统分析、电机设计、高低压电器、电机控制、智能化电器原理与应用、电力系统继电保护、电力系统综…

系统启动小知识

登录时不显示欢迎屏幕为了加快计算机启动的速度&#xff0c;我们完全可以通过组策略设置在每次用户登录时将Windows XP欢迎屏幕隐藏。位置&#xff1a;\用户配置\管理模板\系统\ 要显示欢迎屏幕&#xff0c;请依次单击“开始→程序→附件→系统工具”选项&#xff0c;然后单击“…

有哪些编辑软件可以编辑c语言,可以推荐一个手机上最好用且免费的c语言编辑器吗?...

C4droid(又名C编译器)呗&#xff0c;一个既可以编辑&#xff0c;还可以运行C语言的手机编程软件&#xff0c;下面我简单介绍一下这个软件的安装和使用&#xff1a;1.首先&#xff0c;安装C4droid&#xff0c;这个直接在手机应用中搜索就行&#xff0c;如下&#xff0c;大概也就…

cas 4.2.7 官方手册_海城市地区,保险手册核验的简单流程

最近海城市社保正在进行保险手册的核验工作&#xff0c;据说是要将当地社保数据并网&#xff0c;由省社保机构监督管理。我们这个百万人口的县级市&#xff0c;核验工作只由一个部门在固定的办事大厅里完成&#xff0c;工作量也是相当大了。核验工作自9月末开始&#xff0c;已进…

在 C# 中生成代码的四种方式——包括.NET 5中的Source Generators

Microsoft在最新的C#版本中引入了Source Generator。这是一项新功能&#xff0c;可以让我们在代码编译时生成源代码。在本文中&#xff0c;我将介绍四种C#中的代码生成方式&#xff0c;以简化我们的日常工作。然后&#xff0c;您可以视情况选择正确的方法。在 .NET 中&#xff…

powercfg -h off_驭鲛记的主演会是谁?肖战关系特别好的艺人朋友呢?白敬亭和吴映洁有没有故事啊?高伟光是不是隐婚生子了?讲讲管h和马司令呗?...

近期后台提问的比较多&#xff0c;没被翻牌的小可爱们不要着急&#xff0c;我会尽力把大家的问题都照顾到&#xff0c;笔芯1. 扒扒&#xff0c;想知道华策驭鲛记的主演会是谁&#xff1f;主演还没定&#xff0c;女主在接触热巴&#xff0c;男主还没接触&#xff0c;这个戏明年才…

使用 C# 9 的records作为强类型ID - JSON序列化

使用 C# 9 的records作为强类型ID - 路由和查询参数在本系列的上一篇文章中使用 C# 9 的records作为强类型ID - 路由和查询参数&#xff0c;我们注意到强类型ID的实体&#xff0c;序列化为 JSON 的时候报错了&#xff0c;就像这样&#xff1a;{"id": {"value&qu…

HP LaserJet 1010卡纸解决方法

HP LaserJet 1010 系列打印机在打印过程中出现卡纸多由以下原因造成&#xff1a;1、纸盒里放入了过多的纸张或纸张位置没有放好。2、打印时使用的介质类型超出打印机的支持范围。常见卡纸位置&#xff1a;1 、硒鼓下方&#xff1b;2 、进纸口&#xff1b;3 、出纸口图 2&#x…

c语言综合模拟测试题答案,【C语言指针模拟测试题_答案】

1 C 语言指针部分模拟测试题 一 选择题 语句 int a 10 point p B y p C y p p D p y p 语句 char str visual C char p str 则 p 的值为 B A visual C B str 的首地址 C n D v 设有说明语句 char s student Teacher Father Month ps s 2 执行语句 printf c s c s 1 ps ps 则输出…

python实现自动打电话-python 实现手机自动拨打电话的方法(通话压力测试)

现在能用自动化实现的&#xff0c;尽量使用自动化程序去操作&#xff0c;代替人工去操作&#xff0c;更有效率。 今天说下用python结合adb命令去实现安卓手机端的通话压力测试。 #操作前先在设置里打开power键可以结束通话按钮&#xff0c;否则会导致代码报错 from time import…

HP产品选件查询网站

[url]http://h18000.www1.hp.com/products/quickspecs/ProductBulletin.html#intro[/url][url]http://h18006.www1.hp.com/products/quickspecs/Division/12175.html[/url]所有的可通地此链接来查询DL380G5:[url]http://h18004.www1.hp.com/products/quickspecs/12477_div/1247…

c语言程序设计黄保和第二章,C语言程序设计答案(黄保和编)第6章

C语言程序设计答案,答案不唯一,仅供参考一、思考题1、函数总需要从main中调用吗&#xff1f;当调用一个函数时&#xff0c;为什么要使用参数&#xff1f;函数不是总需要从main函数中调用&#xff0c;使用参数的目的是为了给被调函数传递数据。2、什么是函数的返回值&#xff1f…

如何使用 C# 中的 ValueTuple

Tuple 是一种数据结构&#xff0c;它由一个有序的、有限的、大小固定的、不可变的异构元素的序列组成&#xff0c;当我们说 Tuple 中的元素不可变&#xff0c;意味着其中的元素不能进行修改。ValueTuple 是在 C# 7 中被引入&#xff0c;它主要用来解决 Tuple 的两个问题。解决语…

tutte定理证明hall定理_人教社课本现低级错误?“爱因斯坦用相对论证明勾股定理”...

南方加客户端南方加客户端6月18日消息&#xff0c;近日&#xff0c;有网友在网上发帖称&#xff0c;人教版八年级下册数学自读课本中有关“爱因斯坦证明勾股定理”的内容疑似出现错误&#xff0c;此事引发网友关注&#xff0c;目前在社交平台上发酵。网友上传的课本图片据网友上…