public void CanReplaceSimpleValueUsingExpressions() { var t = new SimpleTemplate("asd${asd}asd$qwe"); t.SetMany(asd => 123, qwe => 456); t.ToString().Should().Be("asd123asd456"); }
public void CanReplaceSimpleValueUsingAnonymousObject() { var t = new SimpleTemplate("asd${asd}asd$qwe"); t.SetMany(new { asd = 123, qwe = 456 }); t.ToString().Should().Be("asd123asd456"); }
public void Run() { var types = GetTypes(); using (var project = Options.Do.Model.Project) { foreach (var type in types) { var template = new SimpleTemplate(Templates.AutoService); template["interface"] = "I" + type.Type.GetRealClassName(); template["service"] = type; template["opt"] = Options.Do; project.AddNewCompile(FilePath(type.Type.GetRealClassName()), template.ToString()); } } }
public void Execute() { var timestamp = DateTime.Now.ToString("yyyyMMddHHmmss"); var filename = string.Format("{0}_{1}.cs", timestamp, Name ?? "Untitled"); var template = new SimpleTemplate(Templates.NewMigration); template["timestamp"] = timestamp; template["opt"] = Options.Do; using (var project = Options.Do.Database.Project) { project.AddNewCompile(filename, template.ToString()); if (OpenIt) Process.Start(project.GetFullPath(filename)); } }
public void Run() { var types = GetTypes(); using (var project = Options.Do.Model.Project) { foreach (var type in types) { var entity = type.Type.GetTypeArgumentsFor(typeof(IEntityService<>)).FirstOrDefault(); var template = new SimpleTemplate(Templates.AutoDomain); template["entity"] = entity; template["service"] = type; template["opt"] = Options.Do; project.AddNewCompile(FilePath(entity.Name), template.ToString()); } } }
public void CanReplaceSimpleValueUsingToString() { var t = new SimpleTemplate("asd${asd}asd"); t["asd"] = 123; t.ToString().Should().Be("asd123asd"); }