public RenderManyBlocksBenchmarks() { templateText = "Hello {{name}} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }} blah {{ name }}"; expressTemplateManager = new ExpressTemplateManager <StandardLibrary>(new NullLogger <ExpressTemplateManager <StandardLibrary> >(), new StandardLibrary(), new StatementGenerator(new NullLogger <StatementGenerator>())); scribanTemplate = Template.Parse(templateText); _razorTemplate = RazorBuilder.Compile(@"Hello @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name blah @Model.Name"); }
public static RazorBuilder CreateDefaultDeleteField(PropertyInfo propertyInfo) { var result = new RazorBuilder(); result.AddTag("QnSProjectAward.BlazorApp.Shared.Components.DisplayProperty", $"Model=\"@DeleteModel\" PropertyName=\"@nameof(DeleteModel.{propertyInfo.Name})\""); return(result); }
private static RazorBuilder CreateDefaultGridColumn(PropertyInfo propertyInfo, Action <RazorBuilder> createAction) { propertyInfo.CheckArgument(nameof(propertyInfo)); var result = new RazorBuilder(); var defaultWidth = GetDefaultColumnWidth(propertyInfo); var displayProperty = $"displayProperty{propertyInfo.Name}"; result.OpenCodeBlock("@{") .AddCode($"var {displayProperty} = GetOrCreateDisplayProperty(nameof(TModel.{propertyInfo.Name}));") .OpenTag($"RadzenGridColumn", $"TItem =\"TModel\" Property=\"@{displayProperty}.PropertyName\" Visible=\"@{displayProperty}.IsListVisible\" Width=\"@{displayProperty}.ListWidth\" Sortable=\"@{displayProperty}.IsListSortable\" Filterable=\"@{displayProperty}.IsListFilterable\"") .OpenTag("HeaderTemplate") .AddTag($"RadzenLabel", $"Text=\"@TranslateFor({displayProperty}.PropertyName)\"") .CloseTag() .OpenTag("Template", "Context=\"data\"") .AddCode($"@{displayProperty}.ToDisplay(data, data.{propertyInfo.Name})") .CloseTag() .Execute(createAction) .OpenTag("FooterTemplate") .AddCode($"@{displayProperty}.GetFooterText({displayProperty}.PropertyName)") .CloseTag() .CloseTag() .CloseCodeBlock(); return(result); }
public RenderProducts() { const int ProductCount = 500; products = new List <Product>(ProductCount); for (int i = 0; i < ProductCount; i++) { var product = new Product("Name" + i, i, Lorem); products.Add(product); } expressTemplateManager = new ExpressTemplateManager <StandardLibrary>(new NullLogger <ExpressTemplateManager <StandardLibrary> >(), new StandardLibrary(), new StatementGenerator(new NullLogger <StatementGenerator>())); scribanTemplate = Template.Parse(ScribanTemplateText); _razorTemplate = RazorBuilder.Compile(TestTemplateRazor); }
private static RazorBuilder CreateDefaultEditField(PropertyInfo propertyInfo, Action <Helpers.RazorBuilder> createAction) { var result = new RazorBuilder(); result.AddCode($"@if (CanFieldCreate(nameof(EditModel.{propertyInfo.Name})))") .OpenCodeBlock() .OpenTag("div", "row", string.Empty) .OpenTag("div", "col-md-4 align-items-center d-flex", string.Empty) .AddTag("RadzenLabel", $"Text=\"@TranslateFor(nameof(EditModel.{propertyInfo.Name}))\"") .CloseTag() .OpenTag("div", "col-md-8", "style=\"margin-top: 16px;\"") .Execute(createAction) .CloseTag() .CloseTag() .CloseCodeBlock(); return(result); }
static partial void EndCreateDeleteField(PropertyInfo propertyInfo, RazorBuilder deleteField);
static partial void BeginCreateDeleteField(PropertyInfo propertyInfo, ref RazorBuilder deleteField, ref bool handled);
static partial void EndCreateDisplayField(PropertyInfo propertyInfo, RazorBuilder displayField);
static partial void EndCreateEditField(PropertyInfo propertyInfo, RazorBuilder editField);
static partial void BeginCreateEditField(PropertyInfo propertyInfo, ref RazorBuilder editFild, ref bool handled);
static partial void EndCreateGridColumn(PropertyInfo propertyInfo, RazorBuilder gridColumn);
static partial void BeginCreateGridColumn(PropertyInfo propertyInfo, ref RazorBuilder gridColumn, ref bool handled);
public RenderSimpleTemplate() { expressTemplateManager = new ExpressTemplateManager <StandardLibrary>(new NullLogger <ExpressTemplateManager <StandardLibrary> >(), new StandardLibrary(), new StatementGenerator(new NullLogger <StatementGenerator>())); scribanTemplate = Template.Parse("Hello {{name}}!"); _razorTemplate = RazorBuilder.Compile(@"Hello @Model.Name!"); }