コード例 #1
0
 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");
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 static partial void EndCreateDeleteField(PropertyInfo propertyInfo, RazorBuilder deleteField);
コード例 #7
0
 static partial void BeginCreateDeleteField(PropertyInfo propertyInfo, ref RazorBuilder deleteField, ref bool handled);
コード例 #8
0
 static partial void EndCreateDisplayField(PropertyInfo propertyInfo, RazorBuilder displayField);
コード例 #9
0
 static partial void EndCreateEditField(PropertyInfo propertyInfo, RazorBuilder editField);
コード例 #10
0
 static partial void BeginCreateEditField(PropertyInfo propertyInfo, ref RazorBuilder editFild, ref bool handled);
コード例 #11
0
 static partial void EndCreateGridColumn(PropertyInfo propertyInfo, RazorBuilder gridColumn);
コード例 #12
0
 static partial void BeginCreateGridColumn(PropertyInfo propertyInfo, ref RazorBuilder gridColumn, ref bool handled);
コード例 #13
0
 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!");
 }