Add interface shown in video

This commit is contained in:
Alex Hyett 2023-09-07 13:41:04 +01:00
parent 1962ab2ead
commit 9f59ca3e45
4 changed files with 11 additions and 3 deletions

View file

@ -1,4 +1,4 @@
public class BadLogger public class BadLogger : IBadLogger
{ {
public void Log(string message, LogType logType, LogTarget target, Exception? ex) public void Log(string message, LogType logType, LogTarget target, Exception? ex)
{ {

4
Facade/IBadLogger.cs Normal file
View file

@ -0,0 +1,4 @@
public interface IBadLogger
{
void Log(string message, LogType logType, LogTarget target, Exception? ex);
}

View file

@ -1,6 +1,6 @@
public class Logger : ILogger public class Logger : ILogger
{ {
private readonly BadLogger _logger; private readonly IBadLogger _logger;
public Logger() public Logger()
{ {
_logger = new BadLogger(); _logger = new BadLogger();

View file

@ -11,4 +11,8 @@ I came up with the following 5 Design Patterns:
2. [Decorator Pattern](Decorator) 2. [Decorator Pattern](Decorator)
3. [Observer Pattern](Observer) 3. [Observer Pattern](Observer)
4. [Singleton Pattern](Singleton) 4. [Singleton Pattern](Singleton)
5. [Facade Pattern](Facade) 5. [Facade Pattern](Facade)
To run them just `cd` into each folder and run `dotnet run`.
Note: You will need the .Net Core SDK installed to run these.