[WONT RUN] RazorEngine

This commit is contained in:
Paul Schneider 2018-04-15 13:48:04 +02:00
commit 5f188c99a8
7 changed files with 292 additions and 9237 deletions

7
cli/Modules/IModule.cs Normal file
View file

@ -0,0 +1,7 @@
namespace cli.Modules
{
public interface IModule
{
void Run (string[] args);
}
}

View file

@ -0,0 +1,29 @@
using System;
using RazorEngine.Templating;
using Yavsc.Models;
using Yavsc.Services;
namespace cli.Modules
{
public class MonthlyEMailGenerator : IModule
{
IRazorEngineService engine;
IEmailSender emailSender;
ApplicationDbContext dbContext;
public MonthlyEMailGenerator(ApplicationDbContext context, IRazorEngineService res, IEmailSender sender)
{
dbContext = context;
engine = res;
emailSender = sender;
// engine.AddTemplate(new Tem)
}
public void Run(string[] args)
{
Console.WriteLine($"Hello from second module using {engine}");
string template = "Hello @Model.Name, welcome to RazorEngine!";
var result = engine.RunCompile(template, "templateKey", null, new { Name = "World" });
Console.WriteLine(result);
}
}
}

View file

@ -0,0 +1,25 @@
using System;
using System.IO;
using Microsoft.Extensions.Logging;
using RazorEngine.Configuration;
using RazorEngine.Templating;
namespace cli.Modules
{
public class MyGenerator : IModule
{
ILogger logger;
public MyGenerator(ILoggerFactory loggerfactory)
{
logger = loggerfactory.CreateLogger<MyGenerator>();
}
public void Run(string[] args)
{
logger.LogInformation(nameof(MyGenerator));
}
}
}