Godsaker
med Muscovado-
rörsocker

Dansukker Fairtrademärkta Muscovadorörsocker utvinns ur sockerrör från Mauritius och finns i två varianter. Det ljusa sockret har drag av smörkola och det mörka har toner av lakrits. Här har vi samlat godis och bakverk där Muscovadorörsockrets läckra aromer får sällskap av allt från mandel och nötter till mörk choklad och kardemumma. Servera till nybryggt kaffe och njut!

Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81

Tips!

Muscovadorörsocker är ett fuktigt socker och kan ibland klumpa sig. Att det inte är fririnnande är en del av charmen. Då sockret kommer i kontakt med luft blir det lätt hårt. För att få det mjukt igen så lägg t ex en äppel- eller potatisklyfta eller en fuktad trasa i sockret. Tänk också på att alltid försluta påsen ordentligt och förvara det svalt, gärna i kylskåp.

Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81

Tips!

Mörkt Muscovadorörsocker ger intressanta smakbrytningar, speciellt tillsammans med choklad. Prova att ersätta strösockret med Mörkt Muscovadorörsocker i chokladbakverk och desserter som t ex cookies, brownies och tryfflar.

Ljust Muscovadorörsocker används med fördel som krydda i matlagning. Passar mycket bra till fisk och rotfrukter. Förhöjer smaken på bröd, mjuka kakor, småkakor, desserter, marinader, såser och inläggningar.

Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81
Error executing template "Designs/Swift/Paragraph/RecipeInsertBlock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.<>c__DisplayClass0_0.<FindAndRenderProduct>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 35
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ce4531f0a1e44cebc8275cfe494bfdb.Execute() in E:\Dynamicweb.Net\Solutions\Dynamicweb\dansukker.prod\Swift-Files\Templates\Designs\Swift\Paragraph\RecipeInsertBlock.cshtml:line 15
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Indexing.Querying 5 @using Dynamicweb.Ecommerce 6 7 @{ 8 if (Model.Item.GetRawValueString("Product") == "") 9 { 10 return; 11 } 12 13 @* only ONE product, the first selected in the list, is rendered in this block*@ 14 string firstProductId = Model.Item.GetRawValueString("Product").Split(',')[0].Replace("p_", "").Replace(":", ""); 15 @FindAndRenderProduct(firstProductId); 16 } 17 18 19 @helper FindAndRenderProduct(string productId) 20 { 21 var queryService = ServiceLocator.Current.GetInstance<IQueryService>(); 22 var query = queryService.LoadQuery("All", "QueryAll.query"); 23 var settings = new QuerySettings 24 { 25 Skip = 0, 26 Take = 1, 27 Parameters = new Dictionary<string, object> 28 { 29 { "doctype", new[] { "Recipes" } }, 30 { "docID", new[] { productId } } 31 } 32 }; 33 var result = queryService.Query(query, settings); 34 35 foreach (Dictionary<string, object> document in result.QueryResult) 36 { 37 // Performance drawback when getting the product object from api service / DB for each recipe insert block, faster do display the data from the indexed document directly 38 // var product = Services.Products.GetProductById((string)document["ID"], "", Pageview.Area.EcomLanguageId); 39 40 Dynamicweb.Frontend.FileViewModel imageFile = new Dynamicweb.Frontend.FileViewModel(); 41 string imagePath = (string)@document["Image"] ?? ""; 42 imageFile.Path = imagePath; 43 44 string linkURL = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Recipes") + "&productid=" + (string)document["ID"]; 45 46 <div class="h-100 position-relative mb-0-last-child"> 47 <div class="flex-fill mb-0-last-child"> 48 @RenderImage(imageFile, Model.Item) 49 @*TAGS COMMENTED OUT <div>@Translate("Recipe")</div>*@ 50 <h3 class="mb-2 h3 mw-75ch fw-bold">@document["Name"]</h3> 51 <div class="mb-3"> 52 <a href="@linkURL" class=" stretched-link"> 53 <span class="visually-hidden">@document["Name"]</span> 54 </a> 55 </div> 56 </div> 57 </div> 58 59 } 60 } 61 62 @helper RenderImage(Dynamicweb.Frontend.FileViewModel imageFile, Dynamicweb.Frontend.ItemViewModel item) 63 { 64 string ratioCssClass = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "ratio" : ""; 65 string ratioVariable = Model.Item.GetRawValueString("ImageAspectRatio") != "0" && Model.Item.GetRawValueString("ImageAspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("ImageAspectRatio") + "\"" : ""; 66 67 if (imageFile != null) 68 { 69 var parms = new Dictionary<string, object>(); 70 parms.Add("loading", "lazy"); 71 parms.Add("style", "cover"); 72 parms.Add("alt", ""); 73 parms.Add("columns", 5); 74 75 <figure class="@ratioCssClass" @ratioVariable> 76 @RenderPartial("Components/Image.cshtml", imageFile, parms) 77 </figure> 78 } 79 } 80 81

Har du några frågor rörande våra produkter, recept eller annat så svarar vi gärna.

Baka med sommarens bär

Baka med sommarens bär och bjud på något hembakat till kalaset.

Magiskt god Morotsbulle med frosting

Elsa Billgren och Sofia Wood har tagit fram ett helt nytt bakverk som är härligt saftigt, goffigt, kryddigt och alldeles underbart. Ett recept du inte vill missa!

Härliga jordgubbstider

Låt dig inspireras av våra recept med jordgubbar som ingrediens.

Gör din egen glass

Här har vi samlat våra bästa glassrecept, men experimentera gärna fram dina egna favoriter!

Syltskolan

I vår Syltskola hittar du alla tips om hur du kokar sylt, frågor och svar och recept.

Sommardesserter

När det är varmt är det extra gott att bjuda på en sötsyrlig och fräsch sommardessert som avslutning på grillkvällen eller sommarfesten.