diff --git a/Yavsc.Abstract/Templates/Template.cs b/Yavsc.Abstract/Templates/Template.cs index eecee91e..1e9b0323 100644 --- a/Yavsc.Abstract/Templates/Template.cs +++ b/Yavsc.Abstract/Templates/Template.cs @@ -10,8 +10,7 @@ namespace Yavsc.Abstract.Templates public abstract class Template { - StringBuilder _buffer = new StringBuilder(); - + StringBuilder _buffer ; public virtual void Write(object value) { WriteLiteral(value); } @@ -25,7 +24,9 @@ namespace Yavsc.Abstract.Templates } } - public abstract Task ExecuteAsync(); + public virtual void Init() { + _buffer = new StringBuilder(); + } } } diff --git a/Yavsc/Templates/UserOrientedTemplate.cs b/Yavsc/Templates/UserOrientedTemplate.cs index 26ab7e81..91ede7fb 100644 --- a/Yavsc/Templates/UserOrientedTemplate.cs +++ b/Yavsc/Templates/UserOrientedTemplate.cs @@ -7,12 +7,5 @@ namespace Yavsc.Templates public class UserOrientedTemplate: Template { public ApplicationUser User { get; set; } - - - public override async Task ExecuteAsync () - { - throw new System.NotImplementedException(); - } - } } diff --git a/cli/Services/EMailer.cs b/cli/Services/EMailer.cs index 5eed953c..b351374e 100644 --- a/cli/Services/EMailer.cs +++ b/cli/Services/EMailer.cs @@ -122,17 +122,21 @@ namespace cli.Services using (var ms = new MemoryStream()) { EmitResult result = compilation.Emit(ms); - + foreach (Diagnostic diagnostic in result.Diagnostics.Where(diagnostic => + diagnostic.Severity < DiagnosticSeverity.Error && !diagnostic.IsWarningAsError)) + { + logger.LogWarning("{0}: {1}", diagnostic.Id, diagnostic.GetMessage()); + logger.LogWarning("{0}: {1}", diagnostic.Id, diagnostic.Location.GetLineSpan()); + } if (!result.Success) { IEnumerable failures = result.Diagnostics.Where(diagnostic => diagnostic.IsWarningAsError || diagnostic.Severity == DiagnosticSeverity.Error); - foreach (Diagnostic diagnostic in failures) { logger.LogCritical("{0}: {1}", diagnostic.Id, diagnostic.GetMessage()); - logger.LogDebug("{0}: {1}", diagnostic.Id, diagnostic.Location.GetLineSpan()); + logger.LogCritical("{0}: {1}", diagnostic.Id, diagnostic.Location.GetLineSpan()); } } else @@ -142,12 +146,10 @@ namespace cli.Services Type type = assembly.GetType(DefaultNamespace+"."+className); var generatedtemplate = (UserOrientedTemplate) Activator.CreateInstance(type); - logger.LogInformation(generatedtemplate.ToString()); foreach (var user in dbContext.ApplicationUser) { - logger.LogInformation(user.ToString()); - + logger.LogInformation ("Generation for "+user.UserName); + generatedtemplate.Init(); generatedtemplate.User = user; - generatedtemplate.ExecuteAsync().Wait(); logger.LogInformation (generatedtemplate.GeneratedText); } diff --git a/cli/project.json b/cli/project.json index 4fe95447..b56ad03f 100644 --- a/cli/project.json +++ b/cli/project.json @@ -38,7 +38,7 @@ "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*", "Microsoft.AspNet.Identity": "3.0.0-rc1-*", - "Yavsc": "1.0.5-rc12", + "Yavsc": "1.0.5-rc13", "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final", "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final", "Microsoft.CodeAnalysis": "1.0.0-rc1" @@ -46,4 +46,4 @@ "frameworks": { "dnx451": {} } -} \ No newline at end of file +} diff --git a/cli/project.lock.json b/cli/project.lock.json index 06263a6e..e49d2f8d 100644 --- a/cli/project.lock.json +++ b/cli/project.lock.json @@ -12024,7 +12024,7 @@ "Microsoft.Extensions.Logging.Console >= 1.0.0-rc1-final", "Microsoft.AspNet.Identity.EntityFramework >= 3.0.0-rc1-*", "Microsoft.AspNet.Identity >= 3.0.0-rc1-*", - "Yavsc >= 1.0.5-rc12", + "Yavsc >= 1.0.5-rc13", "Microsoft.Extensions.DependencyInjection.Abstractions >= 1.0.0-rc1-final", "Microsoft.Extensions.Logging.Debug >= 1.0.0-rc1-final", "Microsoft.CodeAnalysis >= 1.0.0-rc1"