change logtype
This commit is contained in:
@ -16,6 +16,15 @@ namespace AutoFacSamles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class EmailLog : ILog
|
||||||
|
{
|
||||||
|
private const string adminEmail = "tfoman@oeman.se";
|
||||||
|
public void Write(string message)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Email sent to {adminEmail} : {message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class Engine
|
public class Engine
|
||||||
{
|
{
|
||||||
private ILog log;
|
private ILog log;
|
||||||
@ -55,7 +64,7 @@ namespace AutoFacSamles
|
|||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
builder.RegisterType<ConsoleLog>().As<ILog>();
|
builder.RegisterType<EmailLog>().As<ILog>();
|
||||||
builder.RegisterType<Engine>();
|
builder.RegisterType<Engine>();
|
||||||
builder.RegisterType<Car>();
|
builder.RegisterType<Car>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user