Pattern: Facade
Description
Facade is is an object that provides a simplified interface to a larger body of code, such as a class library.
Example in .NET :
Facade
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 | using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; namespace Facade; internal class FacadeDemo { public static void ExecuteSql() { MyDbContext cnt = new (); //calling the facade DatabaseFacade dbFacade = cnt.Database; dbFacade.EnsureCreated(); } } public class MyDbContext:DbContext { } |
Learn More
Homework
Implement a Facade that will allow you to display a question in a MessageBox with a single method call in a console application and return yes/no as a result.
Leave a Reply