Blog posts by David Vujic2016-05-10T21:49:00.0000000Z/blogs/David-Vujic/Optimizely WorldUnit test Commerce projects with FakeMakerhttp://davidvujic.blogspot.com/2016/05/unit-test-commerce-projects-with-fakemaker.html2016-05-10T21:49:00.0000000Z<span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker is updated with support for unit testing Episerver Commerce code. I am very excited about this and hope it will be useful in your projects. The new version is made with contributions and feedback by users of FakeMaker. Thank you! </span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Install the new plugin to FakeMaker - called <a href="https://www.nuget.org/packages/FakeMaker.Commerce/" target="_blank">FakeMaker.Commerce</a> - from NuGet, or check out the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">source code on GitHub</a>. The package currently suppport basic unit testing scenarios. What kind of features are missing? Contact me by creating a GitHub issue, sending a pull request or just write a comment on this blog.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;"><b>What is FakeMaker?</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker takes care of mocking and a simplifies creating fake content, that you can use when testing your code.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Unit testing the EPiServer CMS got a whole lot easier alredy with version 7. However, creating fake content to be used when setting up mocked repositories isn't always that smooth. When mocking of code is all you see on your screen, this little library may help. A bigger screen probably also would, but is probably more expensive. FakeMaker make it easier to write unit tests for mvc controllers and helpers that expect the episerver repositories to return content. And now also for creating fake Commerce content.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;"><b>How does the Commerce support work?</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">Just like when creating fake pages in FakeMaker</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">var page = FakePage.Create("MyPageName");</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">you can create fake products with FakeMaker.Commerce in the same way:</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">var product = FakeProduct.Create<ProductContent><productcontent><productcontent>("My Fake Product");</productcontent></productcontent></span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Add pages and products to the repository and you are ready to go.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">fake.AddToRepository(product);</span><br /><br /><span style="font-family: "trebuchet ms" , sans-serif;"><b>Get FakeMaker</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">Read more, have a look at the source code and contribute to the project: <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">https://github.com/DavidVujic/EPiServer-FakeMaker</a></span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker NuGet package: <a href="https://www.nuget.org/packages/FakeMaker/" target="_blank">https://www.nuget.org/packages/FakeMaker/</a></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker.Commerce NuGet package: </span><a href="https://www.nuget.org/packages/FakeMaker.Commerce/" style="font-family: 'Trebuchet MS', sans-serif;" target="_blank">https://www.nuget.org/packages/FakeMaker.Commerce/</a>Unit test Commerce projects with FakeMakerhttps://davidvujic.blogspot.com/2016/05/unit-test-commerce-projects-with-fakemaker.html2016-05-10T21:49:00.0000000Z<span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker is updated with support for unit testing Episerver Commerce code. I am very excited about this and hope it will be useful in your projects. The new version is made with contributions and feedback by users of FakeMaker. Thank you! </span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Install the new plugin to FakeMaker - called <a href="https://www.nuget.org/packages/FakeMaker.Commerce/" target="_blank">FakeMaker.Commerce</a> - from NuGet, or check out the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">source code on GitHub</a>. The package currently suppport basic unit testing scenarios. What kind of features are missing? Contact me by creating a GitHub issue, sending a pull request or just write a comment on this blog.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;"><b>What is FakeMaker?</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker takes care of mocking and a simplifies creating fake content, that you can use when testing your code.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Unit testing the EPiServer CMS got a whole lot easier alredy with version 7. However, creating fake content to be used when setting up mocked repositories isn't always that smooth. When mocking of code is all you see on your screen, this little library may help. A bigger screen probably also would, but is probably more expensive. FakeMaker make it easier to write unit tests for mvc controllers and helpers that expect the episerver repositories to return content. And now also for creating fake Commerce content.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;"><b>How does the Commerce support work?</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">Just like when creating fake pages in FakeMaker</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">var page = FakePage.Create("MyPageName");</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">you can create fake products with FakeMaker.Commerce in the same way:</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">var product = FakeProduct.Create<ProductContent><productcontent><productcontent>("My Fake Product");</productcontent></productcontent></span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Add pages and products to the repository and you are ready to go.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">fake.AddToRepository(product);</span><br /><br /><span style="font-family: "trebuchet ms" , sans-serif;"><b>Get FakeMaker</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">Read more, have a look at the source code and contribute to the project: <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">https://github.com/DavidVujic/EPiServer-FakeMaker</a></span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker NuGet package: <a href="https://www.nuget.org/packages/FakeMaker/" target="_blank">https://www.nuget.org/packages/FakeMaker/</a></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker.Commerce NuGet package: </span><a href="https://www.nuget.org/packages/FakeMaker.Commerce/" style="font-family: 'Trebuchet MS', sans-serif;" target="_blank">https://www.nuget.org/packages/FakeMaker.Commerce/</a>Unit test Commerce projects with FakeMakerhttps://davidvujic.blogspot.com/2016/05/unit-test-commerce-projects-with-fakemaker.html2016-05-10T19:49:00.0000000Z<span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker is updated with support for unit testing Episerver Commerce code. I am very excited about this and hope it will be useful in your projects. The new version is made with contributions and feedback by users of FakeMaker. Thank you! </span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Install the new plugin to FakeMaker - called <a href="https://www.nuget.org/packages/FakeMaker.Commerce/" target="_blank">FakeMaker.Commerce</a> - from NuGet, or check out the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">source code on GitHub</a>. The package currently suppport basic unit testing scenarios. What kind of features are missing? Contact me by creating a GitHub issue, sending a pull request or just write a comment on this blog.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;"><b>What is FakeMaker?</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker takes care of mocking and a simplifies creating fake content, that you can use when testing your code.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Unit testing the EPiServer CMS got a whole lot easier alredy with version 7. However, creating fake content to be used when setting up mocked repositories isn't always that smooth. When mocking of code is all you see on your screen, this little library may help. A bigger screen probably also would, but is probably more expensive. FakeMaker make it easier to write unit tests for mvc controllers and helpers that expect the episerver repositories to return content. And now also for creating fake Commerce content.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;"><b>How does the Commerce support work?</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">Just like when creating fake pages in FakeMaker</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">var page = FakePage.Create("MyPageName");</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">you can create fake products with FakeMaker.Commerce in the same way:</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">var product = FakeProduct.Create<ProductContent><productcontent><productcontent>("My Fake Product");</productcontent></productcontent></span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">Add pages and products to the repository and you are ready to go.</span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "courier new" , "courier" , monospace;">fake.AddToRepository(product);</span><br /><br /><span style="font-family: "trebuchet ms" , sans-serif;"><b>Get FakeMaker</b></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">Read more, have a look at the source code and contribute to the project: <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">https://github.com/DavidVujic/EPiServer-FakeMaker</a></span><br /><span style="font-family: "trebuchet ms" , sans-serif;"><br /></span><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker NuGet package: <a href="https://www.nuget.org/packages/FakeMaker/" target="_blank">https://www.nuget.org/packages/FakeMaker/</a></span><br /><span style="font-family: "trebuchet ms" , sans-serif;">FakeMaker.Commerce NuGet package: </span><a href="https://www.nuget.org/packages/FakeMaker.Commerce/" style="font-family: 'Trebuchet MS', sans-serif;" target="_blank">https://www.nuget.org/packages/FakeMaker.Commerce/</a>FakeMaker is updated with Episerver 9 supporthttp://davidvujic.blogspot.com/2016/02/fakemaker-is-updated-with-episerver-9-support.html2016-02-06T10:16:00.0000000Z<span style="font-family: Trebuchet MS, sans-serif;">Hi Episerver developers!</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">I have updated <a href="https://www.nuget.org/packages/fakemaker" target="_blank">FakeMaker</a> (helping you unit test your Episerver code) to support the version 9 binaries. Breaking changes caused compile errors (oops!) and made the tool incompatible with the latest versions of Episerver. It turns out that the base library context no longer has to be mocked, and that's a good thing! The solution was simple: <b>delete code</b>. I love deleting code, maybe even more than writing code.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>FakeMaker</i> may help you <b>delete your code</b>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">When writing unit tests, creating fake content and mocked repositories can be a bit depressing. When mocked code is all you see on your screen, this little library may help. A bigger screen probably also would, but is probably more expensive (and won't cure depression).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">The latest version is available for download on <a href="https://www.nuget.org/packages/fakemaker" target="_blank">NuGet</a>, and the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">source code is on GitHub</a>. Both are targeting version 9.6.1 of the Episerver Core libraries.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">If you need Episerver 8 support, download an earlier version from NuGet, or clone the GitHub repo and checkout the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker/tree/epi-8-support" rel="nofollow" target="_blank">epi-8-support branch</a>. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>Please let me know if you have feature requests or run into any issues.</b></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">Here's an example of what you can do with FakeMaker: </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><i>you are about to write code that uses the episerver page tree to find pages of a certain type, children of a root node, or maybe just the start page. FakeMaker makes easier to write unit tests for code like that, by creating an in memory page tree and add it to a fake content repository.</i></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Create the pages you need:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var page = FakePage.Create("MyPageName");</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>or a page of a specific page type:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var myCustomPage = FakePage.Create<CustomPageData></span><span style="color: blue; font-family: 'Courier New', Courier, monospace;">("MyOtherPageName");</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Create an instance of FakeMaker:<span class="Apple-tab-span" style="white-space: pre;"> </span></i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var fake = new FakeMaker();</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Add it to the mocked repository:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">fake.AddToRepository(page);</span><br /><span style="font-family: Courier New, Courier, monospace;"><b><br /></b></span><b><span style="font-family: Trebuchet MS, sans-serif;">Want more examples?</span></b><br /><span style="font-family: Trebuchet MS, sans-serif;">You will find more examples at the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker/tree/master/FakeMaker.Examples" target="_blank">FakeMaker GitHub repo</a>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>FakeMaker is updated with Episerver 9 supporthttps://davidvujic.blogspot.com/2016/02/fakemaker-is-updated-with-episerver-9-support.html2016-02-06T10:16:00.0000000Z<span style="font-family: Trebuchet MS, sans-serif;">Hi Episerver developers!</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">I have updated <a href="https://www.nuget.org/packages/fakemaker" target="_blank">FakeMaker</a> (helping you unit test your Episerver code) to support the version 9 binaries. Breaking changes caused compile errors (oops!) and made the tool incompatible with the latest versions of Episerver. It turns out that the base library context no longer has to be mocked, and that's a good thing! The solution was simple: <b>delete code</b>. I love deleting code, maybe even more than writing code.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>FakeMaker</i> may help you <b>delete your code</b>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">When writing unit tests, creating fake content and mocked repositories can be a bit depressing. When mocked code is all you see on your screen, this little library may help. A bigger screen probably also would, but is probably more expensive (and won't cure depression).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">The latest version is available for download on <a href="https://www.nuget.org/packages/fakemaker" target="_blank">NuGet</a>, and the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">source code is on GitHub</a>. Both are targeting version 9.6.1 of the Episerver Core libraries.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">If you need Episerver 8 support, download an earlier version from NuGet, or clone the GitHub repo and checkout the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker/tree/epi-8-support" rel="nofollow" target="_blank">epi-8-support branch</a>. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>Please let me know if you have feature requests or run into any issues.</b></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">Here's an example of what you can do with FakeMaker: </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><i>you are about to write code that uses the episerver page tree to find pages of a certain type, children of a root node, or maybe just the start page. FakeMaker makes easier to write unit tests for code like that, by creating an in memory page tree and add it to a fake content repository.</i></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Create the pages you need:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var page = FakePage.Create("MyPageName");</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>or a page of a specific page type:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var myCustomPage = FakePage.Create<CustomPageData></span><span style="color: blue; font-family: 'Courier New', Courier, monospace;">("MyOtherPageName");</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Create an instance of FakeMaker:<span class="Apple-tab-span" style="white-space: pre;"> </span></i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var fake = new FakeMaker();</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Add it to the mocked repository:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">fake.AddToRepository(page);</span><br /><span style="font-family: Courier New, Courier, monospace;"><b><br /></b></span><b><span style="font-family: Trebuchet MS, sans-serif;">Want more examples?</span></b><br /><span style="font-family: Trebuchet MS, sans-serif;">You will find more examples at the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker/tree/master/FakeMaker.Examples" target="_blank">FakeMaker GitHub repo</a>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>FakeMaker is updated with Episerver 9 supporthttps://davidvujic.blogspot.com/2016/02/fakemaker-is-updated-with-episerver-9-support.html2016-02-06T09:16:00.0000000Z<span style="font-family: Trebuchet MS, sans-serif;">Hi Episerver developers!</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">I have updated <a href="https://www.nuget.org/packages/fakemaker" target="_blank">FakeMaker</a> (helping you unit test your Episerver code) to support the version 9 binaries. Breaking changes caused compile errors (oops!) and made the tool incompatible with the latest versions of Episerver. It turns out that the base library context no longer has to be mocked, and that's a good thing! The solution was simple: <b>delete code</b>. I love deleting code, maybe even more than writing code.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>FakeMaker</i> may help you <b>delete your code</b>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">When writing unit tests, creating fake content and mocked repositories can be a bit depressing. When mocked code is all you see on your screen, this little library may help. A bigger screen probably also would, but is probably more expensive (and won't cure depression).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">The latest version is available for download on <a href="https://www.nuget.org/packages/fakemaker" target="_blank">NuGet</a>, and the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">source code is on GitHub</a>. Both are targeting version 9.6.1 of the Episerver Core libraries.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">If you need Episerver 8 support, download an earlier version from NuGet, or clone the GitHub repo and checkout the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker/tree/epi-8-support" rel="nofollow" target="_blank">epi-8-support branch</a>. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>Please let me know if you have feature requests or run into any issues.</b></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">Here's an example of what you can do with FakeMaker: </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><i>you are about to write code that uses the episerver page tree to find pages of a certain type, children of a root node, or maybe just the start page. FakeMaker makes easier to write unit tests for code like that, by creating an in memory page tree and add it to a fake content repository.</i></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Create the pages you need:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var page = FakePage.Create("MyPageName");</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>or a page of a specific page type:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var myCustomPage = FakePage.Create<CustomPageData></span><span style="color: blue; font-family: 'Courier New', Courier, monospace;">("MyOtherPageName");</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Create an instance of FakeMaker:<span class="Apple-tab-span" style="white-space: pre;"> </span></i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">var fake = new FakeMaker();</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><i>Add it to the mocked repository:</i></span><br /><span style="color: blue; font-family: 'Courier New', Courier, monospace;">fake.AddToRepository(page);</span><br /><span style="font-family: Courier New, Courier, monospace;"><b><br /></b></span><b><span style="font-family: Trebuchet MS, sans-serif;">Want more examples?</span></b><br /><span style="font-family: Trebuchet MS, sans-serif;">You will find more examples at the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker/tree/master/FakeMaker.Examples" target="_blank">FakeMaker GitHub repo</a>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span>Building a bank with EPiServer?http://davidvujic.blogspot.com/2015/05/building-a-bank-with-episerver.html2015-05-25T22:51:00.0000000Z<h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Can it be done? </span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Yes. And this blog post is about how it can be done. I want to share my thoughts and experiences about writing EPiServer sites, connected to third party services and/or external APIs, with code examples and design suggestions.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Should it be done?</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Yeah, why not? Long answer: if you already have a nice and smooth communication between product owners and developers - a daily constant flow of feature and content production releases - you probably wouldn't need a Content Management System (CMS) at all. But if you release code a couple of times a month, maybe even longer in between the releases (like most companies out there), a CMS is great to have in place. EPiServer is a good choice for that. Let's build a bank with it!<br /><br />Actually, I have built one already. Well, no. Not really. But I wrote an example project with some of the building blocks I think an EPiServer site connected to external back end systems should have. </span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><a href="https://github.com/DavidVujic/Presentations/tree/master/DevSum/BankWithEPiServer" target="_blank">Here's the code (at Github)</a></span></span><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span><br /><br /><div class="separator" style="clear: both; text-align: center;"><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><a href="http://2.bp.blogspot.com/-3EMw8eUUkt8/VWOCPk1NKZI/AAAAAAAABPU/9l0Yl453pZk/s1600/thedevbank.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="286" src="http://2.bp.blogspot.com/-3EMw8eUUkt8/VWOCPk1NKZI/AAAAAAAABPU/9l0Yl453pZk/s400/thedevbank.png" width="400" /></a></span></span></div><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">I know, I know ... it's a very simplistic example. I wanted to get rid of all the noise, and focus on the "core" stuff that I think is important. I think most of the features in the example code are ready for you to use today, a few things are for demo purposes only (like the implementation of the logger interface).</span></span><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span><br /><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">NoScript First</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">The example code is an EPiServer MVC site: one page instance with a form that is posted to a controller on the server. The server code is sending the data to an external web service and the service returns user data to be displayed in the user interface. </span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><b>Let's zoom in to the form and the posting.</b> All user input should be sanitized and validated. The data sent should be restricted to http POST, along with an anti forgery token. Use the built in model binding and data annotations for the validation of data.</span></span><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-X2eWSDg12Pc/VWOCpF3aTqI/AAAAAAAABPc/Ve-5IhUNMPE/s1600/controller.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="110" src="http://2.bp.blogspot.com/-X2eWSDg12Pc/VWOCpF3aTqI/AAAAAAAABPc/Ve-5IhUNMPE/s400/controller.png" width="400" /></a></div><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-jFOZqGmdi74/VWN9a9S8XTI/AAAAAAAABPI/rvT1DUpZ18Q/s1600/dataannotations.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="173" src="http://2.bp.blogspot.com/-jFOZqGmdi74/VWN9a9S8XTI/AAAAAAAABPI/rvT1DUpZ18Q/s400/dataannotations.png" width="400" /></a></div><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">I would recommend you to start developing with JavaScript disabled in the browser. That is a development style I like to call <b>NoScript First</b>. I think it will help you to focus on the security and the basic flow. When you are done with the basics, enable JavaScript and write client side code for a better user experience. You can hijack the form submit action and post the data with ajax, instead of a full page reload.<br /><br />Here's some more info (with code examples) about NoScript First:<br /><a href="http://davidvujic.blogspot.se/2014/03/you-might-not-need-javascript.html" target="_blank">You might not need JavaScript</a></span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">The basics with Dependency Injection</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Try keep the controllers as light weight as possible. Extract methods to specialized helper files and inject all dependencies by using a tool like <b>StructureMap</b>. For testability, use c# interfaces instead of concrete classes when injecting the dependencies.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">There are trade offs: your source code may seem complex at first look, especially for developers not used to these kind of patterns and abstractions. By hiding the implementations behind APIs (interfaces), you can switch between different implementations, even in runtime. But why would anyone want to do that? I'll will answer that shortly.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Isn't unit testing dead?</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Dependency injection will simplify testing. A unit test can focus on a specific part of the source code, by providing it with fake implementations of the dependencies and control the data that is passed between them. But why unit test stuff at all? For me, test driven development is a style. A tool, helping me to write code that is specialized, minimalistic and (hopefully) readable. For me, the actual testing is secondary. That's why I think some parts of the source code can be just fine without unit tests. It is alright! However, be strict with unit testing your validation features, like the custom data annotations in the example code. Write unit tests until you are sure that your validation methods does the right thing. Try different scenarios, not only the happy path. <b>Be evil.</b> If you wake up in the middle of the night, because you had dreamed about ways to bypass the validation, write a unit test that prove it. Solve the issue and run the tests again.<br /><br />To get the dependency injection stuff in place in your controllers, start with a simple unit test "newing up" a controller, develop and refactor the code from there. I think unit tests eventually will help you find the flow, especially when it's done test driven style.<br /><br />If your controllers handles EPiServer content, such as traversing an EPiServer page tree to create menus or lists, I recommend using <a href="http://davidvujic.blogspot.se/2013/12/fakemaker-helping-you-with-test-driven.html" target="_blank">FakeMaker </a>- a tool that simplifies unit testing for scenarios like that.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Something between the web and the services: Providers</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">A third party web service or a back end API is probably developed for general purpose, to be used by many different channels. A web site is specialized and customized. The data passed from a service will most likely not fit perfectly with the view of a web user interface. To create a nice user experience, the data probably has to be rearranged in some way (formatted, combined, simplified, renamed). Do that in a separate class library. <br /><br />Map the data objects from the service to local domain objects that are customized for your user interface. Map the service class properties you need to a local domain object. Let <b>AutoMapper </b>handle the mapping, it's a great tool. Also, make sure you unit test the mappings! Included in AutoMapper, there is a unit testing feature called "AssertConfigurationValid". <b>It has saved my life many times.</b><br /><br />Let the library take care of the connection to the service, and keep the user interface unaware of the service API. The library should have only the features needed by the web user interface, no more than that.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">I would call a library like that a Provider. Consume the providers by injecting them into the web project code (as described earlier with Dependency Injection). The web communicates with the API (the interface) of a Provider, that means that controllers also are unaware of the actual provider implementation (the concrete class). In the example code, the mappings between interfaces and concrete classes is handled by the StructureMap configuration.<br /><br />With providers, you can switch service implementations without the need to alter the code in the web project. The same goes for the providers themselves. One provider implementation can be switched to an other one. But why would anyone want to do that? Okay, maybe it's time to give some answers.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Fake it!</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">During development, the back end services may also be developed in parallel and could go offline from time to time. Being dependent on an unstable external service is risky. To be able to write code, browse and test the features of a site, using fake implementations of providers returning fake data is a way out of the problem. Faking it will make it possible for the team to be "offline" and still be productive, i.e. no direct dependencies to a web service or third party system.<br /><br /><b>There are other practical uses of fake Provider implementations.</b> The site pages that are heavily based on presenting data from back end systems (like an account transaction list) will not look any good at all when logged in as an EPiServer editor (that most likely isn't identified as an existing customer in the back end system). To create a good user experience for editors (and avoiding embarrassing page exceptions in edit mode) fakes can be very useful. Instead of cluttering the controllers with if-else statements all over the place, determining if the current user is an editor or not, you could use your already existing fake providers! That means fake providers actually will be used in production.<br /><br />To be able to switch between fake and live providers, the injected dependencies need some modification. That is because the StructureMap configuration will run on application start, and checking the logged in user role there won't work. It has to be done per request, triggered from the controllers.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Be water, my friend (inject the Factories)</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">You probably already have noticed in the example code that some sort of factory is injected into the controller, and not the actual provider. The provider is retrieved later in the constructor, by calling a factory method. This occurs on every request. The factory method is where the if-else checking takes place. Is the current user an editor or not? The StructureMap configuration also has two implementations added - one fake, one live - for a provider interface. This makes it possible for the factory to pull the desired implementation from the dependency resolver.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><i><b>Note</b>: Today I met <a href="https://twitter.com/jeremydmiller" rel="nofollow" target="_blank">Jeremy D. Miller</a> (the creator of StructureMap) at the <a href="http://www.devsum.se/" rel="nofollow" target="_blank">DevSum</a> conference here in Stockholm, and he showed me some examples on how to configure StructureMap without the need of factories. I like it a lot I will try this out (and update the GitHub code repository). </i></span></span><br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/VqHSbMR_udo/0.jpg" src="https://www.youtube.com/embed/VqHSbMR_udo?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">(Okay, maybe this video hasn't that much to do with injecting Factories, but I like Bruce Lee and think this video is cool)<br /><br /><b> </b></span></span><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><b>What's Pippi Longstocking got to do with it?</b><br />Finally, let's talk about the fake data itself. Using this setup, the development team have the opportunity to <b>stress test the UI</b> every day, by providing data that goes beyond the perfect and well balanced placeholder text areas in the design templates delivered by the UX team. </span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">One obvious thing to test is the name of the logged in user. Here's an idea: add a fake data user with the name <i>Pippilotta Viktualia Rullgardina Krusmynta Efraimsdotter Långstrump</i> (that's the swedish full name of Pippi Longstocking)! How will the user info section of the site behave with a name like that? Well, maybe "Pippilotta Viktualia Långstrump" would be enough, let's not exaggerate. But be aware, in the real world, there are people out there with <b>some really messed up names</b> ... being prepared for it might be a good idea.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">What do you think about all of this? Please share your thoughts and ideas about building a bank with EPiServer.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><a href="https://github.com/DavidVujic/Presentations/tree/master/DevSum/BankWithEPiServer" target="_blank">Here's the code (at Github)</a></span></span> </span></span>Building a bank with EPiServer?https://davidvujic.blogspot.com/2015/05/building-a-bank-with-episerver.html2015-05-25T22:51:00.0000000Z<h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Can it be done? </span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Yes. And this blog post is about how it can be done. I want to share my thoughts and experiences about writing EPiServer sites, connected to third party services and/or external APIs, with code examples and design suggestions.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Should it be done?</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Yeah, why not? Long answer: if you already have a nice and smooth communication between product owners and developers - a daily constant flow of feature and content production releases - you probably wouldn't need a Content Management System (CMS) at all. But if you release code a couple of times a month, maybe even longer in between the releases (like most companies out there), a CMS is great to have in place. EPiServer is a good choice for that. Let's build a bank with it!<br /><br />Actually, I have built one already. Well, no. Not really. But I wrote an example project with some of the building blocks I think an EPiServer site connected to external back end systems should have. </span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><a href="https://github.com/DavidVujic/Presentations/tree/master/DevSum/BankWithEPiServer" target="_blank">Here's the code (at Github)</a></span></span><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span><br /><br /><div class="separator" style="clear: both; text-align: center;"><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><a href="http://2.bp.blogspot.com/-3EMw8eUUkt8/VWOCPk1NKZI/AAAAAAAABPU/9l0Yl453pZk/s1600/thedevbank.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="286" src="http://2.bp.blogspot.com/-3EMw8eUUkt8/VWOCPk1NKZI/AAAAAAAABPU/9l0Yl453pZk/s400/thedevbank.png" width="400" /></a></span></span></div><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">I know, I know ... it's a very simplistic example. I wanted to get rid of all the noise, and focus on the "core" stuff that I think is important. I think most of the features in the example code are ready for you to use today, a few things are for demo purposes only (like the implementation of the logger interface).</span></span><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span><br /><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">NoScript First</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">The example code is an EPiServer MVC site: one page instance with a form that is posted to a controller on the server. The server code is sending the data to an external web service and the service returns user data to be displayed in the user interface. </span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><b>Let's zoom in to the form and the posting.</b> All user input should be sanitized and validated. The data sent should be restricted to http POST, along with an anti forgery token. Use the built in model binding and data annotations for the validation of data.</span></span><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-X2eWSDg12Pc/VWOCpF3aTqI/AAAAAAAABPc/Ve-5IhUNMPE/s1600/controller.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="110" src="http://2.bp.blogspot.com/-X2eWSDg12Pc/VWOCpF3aTqI/AAAAAAAABPc/Ve-5IhUNMPE/s400/controller.png" width="400" /></a></div><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-jFOZqGmdi74/VWN9a9S8XTI/AAAAAAAABPI/rvT1DUpZ18Q/s1600/dataannotations.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="173" src="http://2.bp.blogspot.com/-jFOZqGmdi74/VWN9a9S8XTI/AAAAAAAABPI/rvT1DUpZ18Q/s400/dataannotations.png" width="400" /></a></div><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">I would recommend you to start developing with JavaScript disabled in the browser. That is a development style I like to call <b>NoScript First</b>. I think it will help you to focus on the security and the basic flow. When you are done with the basics, enable JavaScript and write client side code for a better user experience. You can hijack the form submit action and post the data with ajax, instead of a full page reload.<br /><br />Here's some more info (with code examples) about NoScript First:<br /><a href="http://davidvujic.blogspot.se/2014/03/you-might-not-need-javascript.html" target="_blank">You might not need JavaScript</a></span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">The basics with Dependency Injection</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Try keep the controllers as light weight as possible. Extract methods to specialized helper files and inject all dependencies by using a tool like <b>StructureMap</b>. For testability, use c# interfaces instead of concrete classes when injecting the dependencies.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">There are trade offs: your source code may seem complex at first look, especially for developers not used to these kind of patterns and abstractions. By hiding the implementations behind APIs (interfaces), you can switch between different implementations, even in runtime. But why would anyone want to do that? I'll will answer that shortly.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Isn't unit testing dead?</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Dependency injection will simplify testing. A unit test can focus on a specific part of the source code, by providing it with fake implementations of the dependencies and control the data that is passed between them. But why unit test stuff at all? For me, test driven development is a style. A tool, helping me to write code that is specialized, minimalistic and (hopefully) readable. For me, the actual testing is secondary. That's why I think some parts of the source code can be just fine without unit tests. It is alright! However, be strict with unit testing your validation features, like the custom data annotations in the example code. Write unit tests until you are sure that your validation methods does the right thing. Try different scenarios, not only the happy path. <b>Be evil.</b> If you wake up in the middle of the night, because you had dreamed about ways to bypass the validation, write a unit test that prove it. Solve the issue and run the tests again.<br /><br />To get the dependency injection stuff in place in your controllers, start with a simple unit test "newing up" a controller, develop and refactor the code from there. I think unit tests eventually will help you find the flow, especially when it's done test driven style.<br /><br />If your controllers handles EPiServer content, such as traversing an EPiServer page tree to create menus or lists, I recommend using <a href="http://davidvujic.blogspot.se/2013/12/fakemaker-helping-you-with-test-driven.html" target="_blank">FakeMaker </a>- a tool that simplifies unit testing for scenarios like that.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Something between the web and the services: Providers</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">A third party web service or a back end API is probably developed for general purpose, to be used by many different channels. A web site is specialized and customized. The data passed from a service will most likely not fit perfectly with the view of a web user interface. To create a nice user experience, the data probably has to be rearranged in some way (formatted, combined, simplified, renamed). Do that in a separate class library. <br /><br />Map the data objects from the service to local domain objects that are customized for your user interface. Map the service class properties you need to a local domain object. Let <b>AutoMapper </b>handle the mapping, it's a great tool. Also, make sure you unit test the mappings! Included in AutoMapper, there is a unit testing feature called "AssertConfigurationValid". <b>It has saved my life many times.</b><br /><br />Let the library take care of the connection to the service, and keep the user interface unaware of the service API. The library should have only the features needed by the web user interface, no more than that.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">I would call a library like that a Provider. Consume the providers by injecting them into the web project code (as described earlier with Dependency Injection). The web communicates with the API (the interface) of a Provider, that means that controllers also are unaware of the actual provider implementation (the concrete class). In the example code, the mappings between interfaces and concrete classes is handled by the StructureMap configuration.<br /><br />With providers, you can switch service implementations without the need to alter the code in the web project. The same goes for the providers themselves. One provider implementation can be switched to an other one. But why would anyone want to do that? Okay, maybe it's time to give some answers.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Fake it!</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">During development, the back end services may also be developed in parallel and could go offline from time to time. Being dependent on an unstable external service is risky. To be able to write code, browse and test the features of a site, using fake implementations of providers returning fake data is a way out of the problem. Faking it will make it possible for the team to be "offline" and still be productive, i.e. no direct dependencies to a web service or third party system.<br /><br /><b>There are other practical uses of fake Provider implementations.</b> The site pages that are heavily based on presenting data from back end systems (like an account transaction list) will not look any good at all when logged in as an EPiServer editor (that most likely isn't identified as an existing customer in the back end system). To create a good user experience for editors (and avoiding embarrassing page exceptions in edit mode) fakes can be very useful. Instead of cluttering the controllers with if-else statements all over the place, determining if the current user is an editor or not, you could use your already existing fake providers! That means fake providers actually will be used in production.<br /><br />To be able to switch between fake and live providers, the injected dependencies need some modification. That is because the StructureMap configuration will run on application start, and checking the logged in user role there won't work. It has to be done per request, triggered from the controllers.</span></span><br /><h4><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"> </span></span></h4><h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">Be water, my friend (inject the Factories)</span></span></h2><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">You probably already have noticed in the example code that some sort of factory is injected into the controller, and not the actual provider. The provider is retrieved later in the constructor, by calling a factory method. This occurs on every request. The factory method is where the if-else checking takes place. Is the current user an editor or not? The StructureMap configuration also has two implementations added - one fake, one live - for a provider interface. This makes it possible for the factory to pull the desired implementation from the dependency resolver.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><i><b>Note</b>: Today I met <a href="https://twitter.com/jeremydmiller" rel="nofollow" target="_blank">Jeremy D. Miller</a> (the creator of StructureMap) at the <a href="http://www.devsum.se/" rel="nofollow" target="_blank">DevSum</a> conference here in Stockholm, and he showed me some examples on how to configure StructureMap without the need of factories. I like it a lot I will try this out (and update the GitHub code repository). </i></span></span><br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/VqHSbMR_udo/0.jpg" src="https://www.youtube.com/embed/VqHSbMR_udo?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">(Okay, maybe this video hasn't that much to do with injecting Factories, but I like Bruce Lee and think this video is cool)<br /><br /><b> </b></span></span><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><b>What's Pippi Longstocking got to do with it?</b><br />Finally, let's talk about the fake data itself. Using this setup, the development team have the opportunity to <b>stress test the UI</b> every day, by providing data that goes beyond the perfect and well balanced placeholder text areas in the design templates delivered by the UX team. </span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">One obvious thing to test is the name of the logged in user. Here's an idea: add a fake data user with the name <i>Pippilotta Viktualia Rullgardina Krusmynta Efraimsdotter Långstrump</i> (that's the swedish full name of Pippi Longstocking)! How will the user info section of the site behave with a name like that? Well, maybe "Pippilotta Viktualia Långstrump" would be enough, let's not exaggerate. But be aware, in the real world, there are people out there with <b>some really messed up names</b> ... being prepared for it might be a good idea.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;">What do you think about all of this? Please share your thoughts and ideas about building a bank with EPiServer.</span></span><br /><br /><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><span style="font-family: "Trebuchet MS", sans-serif;"><a href="https://github.com/DavidVujic/Presentations/tree/master/DevSum/BankWithEPiServer" target="_blank">Here's the code (at Github)</a></span></span> </span></span>EPiServer and programmer friendly analytics with _tics.jshttp://davidvujic.blogspot.com/2015/05/episerver-and-programmer-friendly-analytics-with-ticsjs.html2015-05-12T22:35:00.0000000Z<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">Writing web analytics client side code should be really simple, and programmer friendly. If simple and programmer friendly, teams will have control over the production code they are maintaining, knowing what it actually does. To support that, I wrote a little JavaScript helper library called <a href="https://github.com/DavidVujic/_tics.js" target="_blank"><b>_tics.js</b></a> a while ago.<br /><br />The main features of _tics.js are (besides basic page tracking) advanced event tracking of form fields, buttons and links, including grabbing field values, value changes and the position of clicked links in a banner list or a menu.<br /><br />What is _tics.js and why should I use it? <a href="http://davidvujic.blogspot.se/2014/10/programmer-friendly-web-analytics-with-ticsjs.html" target="_blank">Read about the features here.</a><br /><br />I recently tried out some of the features of <b>EPiServer 8</b> and came across the new <b>Google Universal Analytics</b> support. My first thought was: <i>Can I use it with the features of _tics.js?</i><br /><br />Yes, and here's how.<br /></span></span><br /><h2><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">EPiServer Google Universal Analytics and _tics.js </span></span></h2><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">All you have to do is provide _tics.js with a <i>Tracking Id</i> and the <i>Tracking domain</i>. With the new Google Universal support of EPiServer 8 (installed via the EPiServer NuGet feed), the values are added by an editor in the EPiServer CMS admin view. I have experimented and found a way to grab those values, and it can be done by using the <i>Accessors </i>class in the <i>GoogleAnalytics.Services</i> namespace. <br /><br /><span style="font-family: "Courier New",Courier,monospace;"><span style="color: blue;">var</span> <b>settings </b>= EPiServer.GoogleAnalytics.Services.Accessors.<b>GetTrackerSettings()</b>;</span><br /><br />You can now provide the data to the client. </span></span><br /><br /><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">Here's an example. I have used the Alloy MVC template (and perhaps written the C# model code a bit sloppy, but I leave the clean code implementation to you).</span></span><br /><br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-gDd6E2XJio4/VVJcIR_fI2I/AAAAAAAABOM/MCsxXnIo778/s1600/serverkod.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="221" src="http://2.bp.blogspot.com/-gDd6E2XJio4/VVJcIR_fI2I/AAAAAAAABOM/MCsxXnIo778/s400/serverkod.PNG" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Grabbing the analytics values and storing them in the View Model.</td></tr></tbody></table><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-MlMFokz0pxA/VVJcIA8DmcI/AAAAAAAABOI/GZbJOJxgcVs/s1600/ticskod.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="275" src="http://4.bp.blogspot.com/-MlMFokz0pxA/VVJcIA8DmcI/AAAAAAAABOI/GZbJOJxgcVs/s400/ticskod.PNG" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Storing the analytics values in html hidden fields. Initializing _tics.js with data.</td></tr></tbody></table><br /><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">With the <i><b>_tics.events()</b></i> function, changes in individual form fields will be tracked and will make it possible to analyze user behavior.<br /><br />In this example, the standard <i><b>_tics.page()</b></i> function is not used (i.e. basic page tracking), because it is already being done by the generated analytics code from the EPiServer Google Analytics Nuget package. <br /><br /><b>Note:</b> Client side code from EPiServer add-ons is rendered by using the Html helper method <i>RequiredClientResources</i>, already used in the Alloy template:<br /><span style="font-family: "Courier New",Courier,monospace;">@Html.RequiredClientResources("Header");</span> </span></span><br /><br /><h2><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">More features? </span></span></h2><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">What about advanced tracking of form fields, like grabbing the actual values and/or the changes in individual fields? The _tics.js library expect form fields to have data attributes (<a href="https://github.com/DavidVujic/_tics.js#the-couldnt-you-just-do-this-scenario" target="_blank">read more about it here</a>). But when using <b>EPiServer XForms</b>, all an editor can add is custom CSS and none of those fancy data attributes. Oh no!<br /><br /><b>Relax.</b> I have written a little JavaScript "add-on", called <b>_tics.cms.js</b>, that solves this for you. <br /><br />You will find it in the <a href="https://github.com/DavidVujic/_tics.js" target="_blank">_tics.js GitHub repository</a> (look in the folder called "add-ons"). Include it in your code and run the function <i><b>_tics.cms.prepareForm()</b></i>.</span></span><br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-IiQ_g6zA-yA/VVJcITvZ2DI/AAAAAAAABOU/HRzapki1IqU/s1600/ticskod2.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="232" src="http://1.bp.blogspot.com/-IiQ_g6zA-yA/VVJcITvZ2DI/AAAAAAAABOU/HRzapki1IqU/s400/ticskod2.PNG" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Add the script and run _tics.cms.prepareForm() before initializing the library.</td></tr></tbody></table><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><br />It checks for CSS class names and adds the corresponding data attributes to the element.</span></span><br /><br /><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">An example: this is what the editor writes in the CSS field if wanting to grab the value of an individual field (using the "getValue" built in function in the library). Please note that it is case sensitive: <span style="font-family: "Courier New",Courier,monospace;">analyze-custom-getValue</span></span></span><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-SvRgMeIhUlk/VVJfGyCZ68I/AAAAAAAABOg/FMoWON65-K4/s1600/add-css.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://1.bp.blogspot.com/-SvRgMeIhUlk/VVJfGyCZ68I/AAAAAAAABOg/FMoWON65-K4/s400/add-css.gif" width="400" /></a></div><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><br /><br />And that's it.</span></span><br /><br /><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">Simple? Programmer friendly? What do you think about it? Please share your feedback!</span></span>EPiServer and programmer friendly analytics with _tics.jshttps://davidvujic.blogspot.com/2015/05/episerver-and-programmer-friendly-analytics-with-ticsjs.html2015-05-12T22:35:00.0000000Z<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">Writing web analytics client side code should be really simple, and programmer friendly. If simple and programmer friendly, teams will have control over the production code they are maintaining, knowing what it actually does. To support that, I wrote a little JavaScript helper library called <a href="https://github.com/DavidVujic/_tics.js" target="_blank"><b>_tics.js</b></a> a while ago.<br /><br />The main features of _tics.js are (besides basic page tracking) advanced event tracking of form fields, buttons and links, including grabbing field values, value changes and the position of clicked links in a banner list or a menu.<br /><br />What is _tics.js and why should I use it? <a href="http://davidvujic.blogspot.se/2014/10/programmer-friendly-web-analytics-with-ticsjs.html" target="_blank">Read about the features here.</a><br /><br />I recently tried out some of the features of <b>EPiServer 8</b> and came across the new <b>Google Universal Analytics</b> support. My first thought was: <i>Can I use it with the features of _tics.js?</i><br /><br />Yes, and here's how.<br /></span></span><br /><h2><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">EPiServer Google Universal Analytics and _tics.js </span></span></h2><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">All you have to do is provide _tics.js with a <i>Tracking Id</i> and the <i>Tracking domain</i>. With the new Google Universal support of EPiServer 8 (installed via the EPiServer NuGet feed), the values are added by an editor in the EPiServer CMS admin view. I have experimented and found a way to grab those values, and it can be done by using the <i>Accessors </i>class in the <i>GoogleAnalytics.Services</i> namespace. <br /><br /><span style="font-family: "Courier New",Courier,monospace;"><span style="color: blue;">var</span> <b>settings </b>= EPiServer.GoogleAnalytics.Services.Accessors.<b>GetTrackerSettings()</b>;</span><br /><br />You can now provide the data to the client. </span></span><br /><br /><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">Here's an example. I have used the Alloy MVC template (and perhaps written the C# model code a bit sloppy, but I leave the clean code implementation to you).</span></span><br /><br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-gDd6E2XJio4/VVJcIR_fI2I/AAAAAAAABOM/MCsxXnIo778/s1600/serverkod.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="221" src="http://2.bp.blogspot.com/-gDd6E2XJio4/VVJcIR_fI2I/AAAAAAAABOM/MCsxXnIo778/s400/serverkod.PNG" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Grabbing the analytics values and storing them in the View Model.</td></tr></tbody></table><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-MlMFokz0pxA/VVJcIA8DmcI/AAAAAAAABOI/GZbJOJxgcVs/s1600/ticskod.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="275" src="http://4.bp.blogspot.com/-MlMFokz0pxA/VVJcIA8DmcI/AAAAAAAABOI/GZbJOJxgcVs/s400/ticskod.PNG" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Storing the analytics values in html hidden fields. Initializing _tics.js with data.</td></tr></tbody></table><br /><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">With the <i><b>_tics.events()</b></i> function, changes in individual form fields will be tracked and will make it possible to analyze user behavior.<br /><br />In this example, the standard <i><b>_tics.page()</b></i> function is not used (i.e. basic page tracking), because it is already being done by the generated analytics code from the EPiServer Google Analytics Nuget package. <br /><br /><b>Note:</b> Client side code from EPiServer add-ons is rendered by using the Html helper method <i>RequiredClientResources</i>, already used in the Alloy template:<br /><span style="font-family: "Courier New",Courier,monospace;">@Html.RequiredClientResources("Header");</span> </span></span><br /><br /><h2><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">More features? </span></span></h2><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">What about advanced tracking of form fields, like grabbing the actual values and/or the changes in individual fields? The _tics.js library expect form fields to have data attributes (<a href="https://github.com/DavidVujic/_tics.js#the-couldnt-you-just-do-this-scenario" target="_blank">read more about it here</a>). But when using <b>EPiServer XForms</b>, all an editor can add is custom CSS and none of those fancy data attributes. Oh no!<br /><br /><b>Relax.</b> I have written a little JavaScript "add-on", called <b>_tics.cms.js</b>, that solves this for you. <br /><br />You will find it in the <a href="https://github.com/DavidVujic/_tics.js" target="_blank">_tics.js GitHub repository</a> (look in the folder called "add-ons"). Include it in your code and run the function <i><b>_tics.cms.prepareForm()</b></i>.</span></span><br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-IiQ_g6zA-yA/VVJcITvZ2DI/AAAAAAAABOU/HRzapki1IqU/s1600/ticskod2.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="232" src="http://1.bp.blogspot.com/-IiQ_g6zA-yA/VVJcITvZ2DI/AAAAAAAABOU/HRzapki1IqU/s400/ticskod2.PNG" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Add the script and run _tics.cms.prepareForm() before initializing the library.</td></tr></tbody></table><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><br />It checks for CSS class names and adds the corresponding data attributes to the element.</span></span><br /><br /><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">An example: this is what the editor writes in the CSS field if wanting to grab the value of an individual field (using the "getValue" built in function in the library). Please note that it is case sensitive: <span style="font-family: "Courier New",Courier,monospace;">analyze-custom-getValue</span></span></span><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-SvRgMeIhUlk/VVJfGyCZ68I/AAAAAAAABOg/FMoWON65-K4/s1600/add-css.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://1.bp.blogspot.com/-SvRgMeIhUlk/VVJfGyCZ68I/AAAAAAAABOg/FMoWON65-K4/s400/add-css.gif" width="400" /></a></div><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;"><br /><br />And that's it.</span></span><br /><br /><span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-size: small;">Simple? Programmer friendly? What do you think about it? Please share your feedback!</span></span>Updates to FakeMaker - helping you with test driven EPiServer developmenthttp://davidvujic.blogspot.com/2015/05/updates-to-fakemaker-helping-you-with-test-driven-development.html2015-05-02T14:40:00.0000000Z<span style="font-family: "Trebuchet MS",sans-serif;">I have updated the FakeMaker Nuget package with some new features that hopefully will make your days as a test driven EPiServer developer a little bit smoother.</span><br /><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><span style="font-family: "Trebuchet MS",sans-serif;"><b>Never heard of FakeMaker? </b><a href="http://davidvujic.blogspot.se/2013/12/fakemaker-helping-you-with-test-driven.html" target="_blank">Here's some info.</a></span><br /><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><span style="font-family: "Trebuchet MS",sans-serif;">The updated Nuget package contains new convenience methods when creating fake pages in your unit tests (added the methods <i>WithChildren</i>, <i>WithLanguageBranch</i>, <i>WithProperty</i> and <i>WithContentTypeId</i>). This was developed by <a href="https://github.com/psst" target="_blank">Kristian Gimring</a> and I merged it to the source code at GitHub quite a while ago. However, I haven't updated in the Nuget package until now. The current version is 1.0.4.<br /><br />Recently, I also recieved feedback and suggestions from <a href="https://github.com/rbaarda" target="_blank">rbaarda</a> and have added the possibility to set a fake page as the actual StartPage, by using the new method <i>AsStartPage </i>(that will set the EPiServer built in property <i>ContentReference.StartPage</i>).<br /><br />The dependencies to EPiServer was also outdated, and the latest version of the Nuget package have those and also the Moq library updated. If your current project is not using the (as for now) latest version of EPiServer, I would suggest you to<b> grab the source code</b> instead (two files only: <b><i>FakeMaker </i></b>and <i><b>FakePage</b></i>), add it to your test project and compile, instead of using the Nuget package version.<br /><br /><b>I want to thank Kristian Gimring and rbaarda for the contributions.</b> I really appreciate it and am happy to see that the tool is used! </span><br /><br /><span style="font-family: "Trebuchet MS",sans-serif;">What features are missing? Let me know! Please contact me by writing a comment in this post, at <a href="https://twitter.com/davidvujic" target="_blank">twitter</a>, as a GitHub pull request or just add an issue to the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">GitHub project</a>.</span>Updates to FakeMaker - helping you with test driven EPiServer developmenthttp://davidvujic.blogspot.com/2015/05/updates-to-fakemaker-helping-you-with-test-driven-development.html2015-05-02T14:40:00.0000000Z<span style="font-family: "Trebuchet MS",sans-serif;">I have updated the FakeMaker Nuget package with some new features that hopefully will make your days as a test driven EPiServer developer a little bit smoother.</span><br /><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><span style="font-family: "Trebuchet MS",sans-serif;"><b>Never heard of FakeMaker? </b><a href="http://davidvujic.blogspot.se/2013/12/fakemaker-helping-you-with-test-driven.html" target="_blank">Here's some info.</a></span><br /><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><span style="font-family: "Trebuchet MS",sans-serif;">The updated Nuget package contains new convenience methods when creating fake pages in your unit tests (added the methods <i>WithChildren</i>, <i>WithLanguageBranch</i>, <i>WithProperty</i> and <i>WithContentTypeId</i>). This was developed by <a href="https://github.com/psst" target="_blank">Kristian Gimring</a> and I merged it to the source code at GitHub quite a while ago. However, I haven't updated in the Nuget package until now. The current version is 1.0.4.<br /><br />Recently, I also recieved feedback and suggestions from <a href="https://github.com/rbaarda" target="_blank">rbaarda</a> and have added the possibility to set a fake page as the actual StartPage, by using the new method <i>AsStartPage </i>(that will set the EPiServer built in property <i>ContentReference.StartPage</i>).<br /><br />The dependencies to EPiServer was also outdated, and the latest version of the Nuget package have those and also the Moq library updated. If your current project is not using the (as for now) latest version of EPiServer, I would suggest you to<b> grab the source code</b> instead (two files only: <b><i>FakeMaker </i></b>and <i><b>FakePage</b></i>), add it to your test project and compile, instead of using the Nuget package version.<br /><br /><b>I want to thank Kristian Gimring and rbaarda for the contributions.</b> I really appreciate it and am happy to see that the tool is used! </span><br /><br /><span style="font-family: "Trebuchet MS",sans-serif;">What features are missing? Let me know! Please contact me by writing a comment in this post, at <a href="https://twitter.com/davidvujic" target="_blank">twitter</a>, as a GitHub pull request or just add an issue to the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">GitHub project</a>.</span>Updates to FakeMaker - helping you with test driven EPiServer developmenthttps://davidvujic.blogspot.com/2015/05/updates-to-fakemaker-helping-you-with-test-driven-development.html2015-05-02T14:40:00.0000000Z<span style="font-family: "Trebuchet MS",sans-serif;">I have updated the FakeMaker Nuget package with some new features that hopefully will make your days as a test driven EPiServer developer a little bit smoother.</span><br /><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><span style="font-family: "Trebuchet MS",sans-serif;"><b>Never heard of FakeMaker? </b><a href="http://davidvujic.blogspot.se/2013/12/fakemaker-helping-you-with-test-driven.html" target="_blank">Here's some info.</a></span><br /><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span><span style="font-family: "Trebuchet MS",sans-serif;">The updated Nuget package contains new convenience methods when creating fake pages in your unit tests (added the methods <i>WithChildren</i>, <i>WithLanguageBranch</i>, <i>WithProperty</i> and <i>WithContentTypeId</i>). This was developed by <a href="https://github.com/psst" target="_blank">Kristian Gimring</a> and I merged it to the source code at GitHub quite a while ago. However, I haven't updated in the Nuget package until now. The current version is 1.0.4.<br /><br />Recently, I also recieved feedback and suggestions from <a href="https://github.com/rbaarda" target="_blank">rbaarda</a> and have added the possibility to set a fake page as the actual StartPage, by using the new method <i>AsStartPage </i>(that will set the EPiServer built in property <i>ContentReference.StartPage</i>).<br /><br />The dependencies to EPiServer was also outdated, and the latest version of the Nuget package have those and also the Moq library updated. If your current project is not using the (as for now) latest version of EPiServer, I would suggest you to<b> grab the source code</b> instead (two files only: <b><i>FakeMaker </i></b>and <i><b>FakePage</b></i>), add it to your test project and compile, instead of using the Nuget package version.<br /><br /><b>I want to thank Kristian Gimring and rbaarda for the contributions.</b> I really appreciate it and am happy to see that the tool is used! </span><br /><br /><span style="font-family: "Trebuchet MS",sans-serif;">What features are missing? Let me know! Please contact me by writing a comment in this post, at <a href="https://twitter.com/davidvujic" target="_blank">twitter</a>, as a GitHub pull request or just add an issue to the <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">GitHub project</a>.</span>Dynamic forms - with a keep it simple approachhttp://davidvujic.blogspot.com/2014/04/dynamic-forms-with-a-keep-it-simple-approach.html2014-04-07T19:58:00.0000000Z<span style="font-family: Trebuchet MS, sans-serif;">Wouldn't it be cool if editors just could <b>drag-and-drop</b> input fields and rearrange the design of forms in <b>EPiServer</b>? I can almost hear you say: XForms. Yes, I've heard about it. I have written a fair amount of code using the good ol' built in EPiServer feature. I have even succeeded in taming the XForm Beast to obey the simple rules of MVC (with help from you great bloggers out there). But that is a different story.</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">What about the forms that need other features than the ones provided by EPiServer XForms?</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;"><b>An example scenario:</b></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">We want to collect user input by using a web based form. The input data should be passed on to a back end system for processing, and should not be stored in the EPiServer database at all. Additionally, the editors want to create different campaign pages with different forms. The editors want to A/B test the campaign pages - to learn how to reshape and adjust the form to maximize conversion rates. Can this be done with EPiServer?</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">Here's a simple solution: blocks.</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">(<a href="https://github.com/DavidVujic/blog/tree/master/Dynamic-Forms" target="_blank">check out the full example at GitHub</a>)</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;"><b>The Input Block</b></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">Let's write a block type that can be used in forms all over the site. Instances of the block type will behave in different ways, when used in different contexts. To succeed with that, each instance of the block type need to have really good answers to some existential questions:</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;"><i><b>What am I?</b></i></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><i><b><br /></b></i></span><span style="font-family: Trebuchet MS, sans-serif;"><i><b>Where do I belong?</b></i></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><i><b><br /></b></i></span><span style="font-family: Trebuchet MS, sans-serif;"><i><b>How should I act in public?</b></i></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">The answers come in the form of <b>categories</b>. It doesn't have to be like that, It's just me. I think categories are cool. They remind me of twitter hash tags (I think twitter hash tags are cool too).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-p-huz_vRVd4/U0LBVGMhGoI/AAAAAAAABLw/saXmZ-c8V-U/s1600/categories.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-p-huz_vRVd4/U0LBVGMhGoI/AAAAAAAABLw/saXmZ-c8V-U/s1600/categories.png" height="130" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>What am I? (Field) Where do I belong? (Group) How should I act? (Behaviour)</i></span></div><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-xFhi7ClV_Xw/U0LBVHqK2GI/AAAAAAAABMU/EdpGqk6AIyY/s1600/block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-xFhi7ClV_Xw/U0LBVHqK2GI/AAAAAAAABMU/EdpGqk6AIyY/s1600/block.png" height="193" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>This instance is a "first name" input field, existing in a "user" context,</i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>with user input set to required.</i></span></div><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>The View</b></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">Now we have the answers to the deep questions asked earlier and can write the user interface. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-nEWKTow0J00/U0LBXDYWr0I/AAAAAAAABMg/kTEDE4fk_9Y/s1600/view.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-nEWKTow0J00/U0LBXDYWr0I/AAAAAAAABMg/kTEDE4fk_9Y/s1600/view.png" height="175" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>The example code has some convenience methods, </i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>such as generating the input field name based on the categories.</i></span></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-WZiLZwGf-Zs/U0LBVwSIBtI/AAAAAAAABMM/Hqj5nuaycEw/s1600/html.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-WZiLZwGf-Zs/U0LBVwSIBtI/AAAAAAAABMM/Hqj5nuaycEw/s1600/html.png" height="287" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>Html output generated with data from the model (the block type).<br />A server side regular expression pattern is also passed on to the client.</i></span></div><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>The Validation</b></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">What about validation? Dynamic forms are by nature quite unpredictable. But we know about the behaviour of the individual block, and can use that knowledge to write both custom client and server validation. In this example I am using the <i><a href="http://foundation.zurb.com/docs/components/abide.html" target="_blank">Zurb Foundation Abide</a> </i>framework to perform client script validation. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-K0OwtSxn9GI/U0LBWvdkMoI/AAAAAAAABMo/5Wq4ajLUMIY/s1600/js.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-K0OwtSxn9GI/U0LBWvdkMoI/AAAAAAAABMo/5Wq4ajLUMIY/s1600/js.png" height="200" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>Custom validator added to the Abide framework, </i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>specialized in validating first name input fields. </i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>The name of the validator is the value of the selected subcategory for "Field".</i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif; font-size: x-small;"><br /></span></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-ZuJr_2NjCQo/U0LBVETwTPI/AAAAAAAABL8/eWDc9DA-4C8/s1600/clientvalidation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-ZuJr_2NjCQo/U0LBVETwTPI/AAAAAAAABL8/eWDc9DA-4C8/s1600/clientvalidation.png" height="250" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>"David" is valid. Nice to know.</i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif; font-size: x-small;"><br /></span></div><br /><span style="font-family: Trebuchet MS, sans-serif;">This example code has two types of server validation. First up is the data annotations defined in the model. Secondly (if necessary) there is also the ability to perform <b>custom validation</b>. What validator to use is determined by the block behaviour (the categories), just like selecting the client validator. Here is where specialized validation takes place, such as dependencies between individual fields in the posted form.</span><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-rT-nmfBuT6M/U0LBVqqaDuI/AAAAAAAABMQ/DgoUlvq7MyM/s1600/controller.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-rT-nmfBuT6M/U0LBVqqaDuI/AAAAAAAABMQ/DgoUlvq7MyM/s1600/controller.png" height="130" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>Form data posted to the controller action method.</i></span></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-uK8xDCqOuZw/U0LBWhIu5YI/AAAAAAAABMs/MZq598oMQcg/s1600/validator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-uK8xDCqOuZw/U0LBWhIu5YI/AAAAAAAABMs/MZq598oMQcg/s1600/validator.png" height="330" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>Going through each item in the page content area,</i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>find the appropriate validator and execute the validation method. </i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>The model is passed to the validator.</i></span></div><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">That's it.</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;"><a href="https://github.com/DavidVujic/blog/tree/master/Dynamic-Forms" target="_blank">Check out the example code at GitHub</a>. To get up and running you need to create an EPiServer 7.5 database and (of course) configure the connectionstrings file.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>I really want your feedback on this.</b> </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">Please post your comments here or contact me on <a href="http://twitter.com/davidvujic" target="_blank">Twitter</a>.</span>Dynamic forms - with a keep it simple approachhttps://davidvujic.blogspot.com/2014/04/dynamic-forms-with-a-keep-it-simple-approach.html2014-04-07T19:58:00.0000000Z<span style="font-family: Trebuchet MS, sans-serif;">Wouldn't it be cool if editors just could <b>drag-and-drop</b> input fields and rearrange the design of forms in <b>EPiServer</b>? I can almost hear you say: XForms. Yes, I've heard about it. I have written a fair amount of code using the good ol' built in EPiServer feature. I have even succeeded in taming the XForm Beast to obey the simple rules of MVC (with help from you great bloggers out there). But that is a different story.</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">What about the forms that need other features than the ones provided by EPiServer XForms?</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;"><b>An example scenario:</b></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">We want to collect user input by using a web based form. The input data should be passed on to a back end system for processing, and should not be stored in the EPiServer database at all. Additionally, the editors want to create different campaign pages with different forms. The editors want to A/B test the campaign pages - to learn how to reshape and adjust the form to maximize conversion rates. Can this be done with EPiServer?</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">Here's a simple solution: blocks.</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">(<a href="https://github.com/DavidVujic/blog/tree/master/Dynamic-Forms" target="_blank">check out the full example at GitHub</a>)</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;"><b>The Input Block</b></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">Let's write a block type that can be used in forms all over the site. Instances of the block type will behave in different ways, when used in different contexts. To succeed with that, each instance of the block type need to have really good answers to some existential questions:</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;"><i><b>What am I?</b></i></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><i><b><br /></b></i></span><span style="font-family: Trebuchet MS, sans-serif;"><i><b>Where do I belong?</b></i></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><i><b><br /></b></i></span><span style="font-family: Trebuchet MS, sans-serif;"><i><b>How should I act in public?</b></i></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">The answers come in the form of <b>categories</b>. It doesn't have to be like that, It's just me. I think categories are cool. They remind me of twitter hash tags (I think twitter hash tags are cool too).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-p-huz_vRVd4/U0LBVGMhGoI/AAAAAAAABLw/saXmZ-c8V-U/s1600/categories.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-p-huz_vRVd4/U0LBVGMhGoI/AAAAAAAABLw/saXmZ-c8V-U/s1600/categories.png" height="130" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>What am I? (Field) Where do I belong? (Group) How should I act? (Behaviour)</i></span></div><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-xFhi7ClV_Xw/U0LBVHqK2GI/AAAAAAAABMU/EdpGqk6AIyY/s1600/block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-xFhi7ClV_Xw/U0LBVHqK2GI/AAAAAAAABMU/EdpGqk6AIyY/s1600/block.png" height="193" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>This instance is a "first name" input field, existing in a "user" context,</i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>with user input set to required.</i></span></div><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>The View</b></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">Now we have the answers to the deep questions asked earlier and can write the user interface. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-nEWKTow0J00/U0LBXDYWr0I/AAAAAAAABMg/kTEDE4fk_9Y/s1600/view.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-nEWKTow0J00/U0LBXDYWr0I/AAAAAAAABMg/kTEDE4fk_9Y/s1600/view.png" height="175" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>The example code has some convenience methods, </i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>such as generating the input field name based on the categories.</i></span></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-WZiLZwGf-Zs/U0LBVwSIBtI/AAAAAAAABMM/Hqj5nuaycEw/s1600/html.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-WZiLZwGf-Zs/U0LBVwSIBtI/AAAAAAAABMM/Hqj5nuaycEw/s1600/html.png" height="287" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>Html output generated with data from the model (the block type).<br />A server side regular expression pattern is also passed on to the client.</i></span></div><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>The Validation</b></span><br /><span style="font-family: 'Trebuchet MS', sans-serif;">What about validation? Dynamic forms are by nature quite unpredictable. But we know about the behaviour of the individual block, and can use that knowledge to write both custom client and server validation. In this example I am using the <i><a href="http://foundation.zurb.com/docs/components/abide.html" target="_blank">Zurb Foundation Abide</a> </i>framework to perform client script validation. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-K0OwtSxn9GI/U0LBWvdkMoI/AAAAAAAABMo/5Wq4ajLUMIY/s1600/js.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-K0OwtSxn9GI/U0LBWvdkMoI/AAAAAAAABMo/5Wq4ajLUMIY/s1600/js.png" height="200" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>Custom validator added to the Abide framework, </i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>specialized in validating first name input fields. </i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>The name of the validator is the value of the selected subcategory for "Field".</i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif; font-size: x-small;"><br /></span></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-ZuJr_2NjCQo/U0LBVETwTPI/AAAAAAAABL8/eWDc9DA-4C8/s1600/clientvalidation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-ZuJr_2NjCQo/U0LBVETwTPI/AAAAAAAABL8/eWDc9DA-4C8/s1600/clientvalidation.png" height="250" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>"David" is valid. Nice to know.</i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif; font-size: x-small;"><br /></span></div><br /><span style="font-family: Trebuchet MS, sans-serif;">This example code has two types of server validation. First up is the data annotations defined in the model. Secondly (if necessary) there is also the ability to perform <b>custom validation</b>. What validator to use is determined by the block behaviour (the categories), just like selecting the client validator. Here is where specialized validation takes place, such as dependencies between individual fields in the posted form.</span><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-rT-nmfBuT6M/U0LBVqqaDuI/AAAAAAAABMQ/DgoUlvq7MyM/s1600/controller.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-rT-nmfBuT6M/U0LBVqqaDuI/AAAAAAAABMQ/DgoUlvq7MyM/s1600/controller.png" height="130" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>Form data posted to the controller action method.</i></span></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-uK8xDCqOuZw/U0LBWhIu5YI/AAAAAAAABMs/MZq598oMQcg/s1600/validator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-uK8xDCqOuZw/U0LBWhIu5YI/AAAAAAAABMs/MZq598oMQcg/s1600/validator.png" height="330" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>Going through each item in the page content area,</i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>find the appropriate validator and execute the validation method. </i></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><i>The model is passed to the validator.</i></span></div><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;">That's it.</span><br /><span style="font-family: 'Trebuchet MS', sans-serif;"><br /></span><span style="font-family: 'Trebuchet MS', sans-serif;"><a href="https://github.com/DavidVujic/blog/tree/master/Dynamic-Forms" target="_blank">Check out the example code at GitHub</a>. To get up and running you need to create an EPiServer 7.5 database and (of course) configure the connectionstrings file.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>I really want your feedback on this.</b> </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">Please post your comments here or contact me on <a href="http://twitter.com/davidvujic" target="_blank">Twitter</a>.</span>Quick Start: EPiServer 7.5 & mvc - the minified versionhttp://davidvujic.blogspot.com/2014/03/quick-start-episerver-7-and-mvc.html2014-03-17T17:13:00.0000000Z<span style="font-family: Trebuchet MS, sans-serif;"><b>What is EPiServer and what does EPiServer 7.5 do? </b></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">I (think) that I have aswered those questions during lunch hour today here at Knowit in Stockholm. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">This video - in swedish - is a minified version of my talk & live coding about the CMS, using asp.net mvc to demo how page types, properties, editor features and pages are wired together (without complicating things too much).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>Do you have feedback about this presentation?</b> Please contact me by writing a comment at this blog post or at <a href="https://twitter.com/davidvujic" target="_blank">twitter</a>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><br /></span> <iframe allowfullscreen="" frameborder="0" height="281" mozallowfullscreen="" src="//player.vimeo.com/video/89315100" webkitallowfullscreen="" width="500"></iframe>Quick Start: EPiServer 7.5 & mvc - the minified versionhttps://davidvujic.blogspot.com/2014/03/quick-start-episerver-7-and-mvc.html2014-03-17T17:13:00.0000000Z<span style="font-family: Trebuchet MS, sans-serif;"><b>What is EPiServer and what does EPiServer 7.5 do? </b></span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">I (think) that I have aswered those questions during lunch hour today here at Knowit in Stockholm. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">This video - in swedish - is a minified version of my talk & live coding about the CMS, using asp.net mvc to demo how page types, properties, editor features and pages are wired together (without complicating things too much).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><b>Do you have feedback about this presentation?</b> Please contact me by writing a comment at this blog post or at <a href="https://twitter.com/davidvujic" target="_blank">twitter</a>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><br /></span> <iframe allowfullscreen="" frameborder="0" height="281" mozallowfullscreen="" src="//player.vimeo.com/video/89315100" webkitallowfullscreen="" width="500"></iframe>FakeMaker - helping you with test driven EPiServer developmenthttp://davidvujic.blogspot.com/2013/12/fakemaker-helping-you-with-test-driven.html2013-12-30T16:38:00.0000000Z<div style="color: #333333; line-height: 25px; margin-bottom: 15px; margin-top: 15px;"><span style="font-family: Trebuchet MS, sans-serif;">Test driven development <b>and </b>EPiServer?</span></div><div style="color: #333333; line-height: 25px; margin-bottom: 15px; margin-top: 15px;"><span style="font-family: Trebuchet MS, sans-serif;"><b>Relax.</b> Test driving the CMS actually got a whole lot easier with version 7. Most of the built in features are implementing interfaces <b>and</b> you can use asp.net mvc. Those ones are two really good friends of test driven development. </span><span style="font-family: 'Trebuchet MS', sans-serif;">However, creating that fake content and set up mocked repositories isn't really as smooth as it should (could) be, right?</span></div><div style="color: #333333; line-height: 25px; margin-bottom: 15px; margin-top: 15px;"><span style="font-family: Trebuchet MS, sans-serif;">When mocking code is all you see on your screen, this little library called <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">FakeMaker</a> may help you. Okay, a bigger screen also would, but is probably more expensive. </span><span style="font-family: 'Trebuchet MS', sans-serif;">With FakeMaker, you have two classes: FakeMaker and FakePage. The FakeMaker class takes care of the mocking and FakePage helps you create content.</span></div><div style="margin-bottom: 15px; margin-top: 15px;"><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><b>Here's some examples.</b></span></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;">Create an instance of FakeMaker:</span></span><br /><span style="color: #333333; font-family: Courier New, Courier, monospace;"><span style="line-height: 25px;">var fake = new FakeMaker();</span></span><br /><div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;"><br /></span></span></div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;">Create the pages you need:</span></span></div><div><span style="color: #333333; font-family: Courier New, Courier, monospace;"><span style="line-height: 25px;">var page = FakePage.<b>Create</b>("MyPageName");</span></span></div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;"><br /></span></span></div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;">or a page of a specific page type:</span></span></div><div><span style="color: #333333; font-family: Courier New, Courier, monospace;"><span style="line-height: 25px;">FakePage.<b>Create</b><CustomPageData>("MyOtherPageName");</span></span></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div></div><div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;">Add it to the mocked repository:</span></span></div><div><span style="color: #333333;"><span style="line-height: 25px;"><span style="font-family: Courier New, Courier, monospace;">fake.<b>AddToRepository</b>(page)</span><span style="font-family: Trebuchet MS, sans-serif;">;</span></span></span></div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;"><br /></span></span></div><div><span style="color: #333333;"><span style="line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;">You can now pass the fake repository to your code (also known as Dependency Injection) from the </span><span style="font-family: Courier New, Courier, monospace;">ContentRepository</span><span style="font-family: Trebuchet MS, sans-serif;"> property or use the built in EPiServer </span><span style="font-family: Courier New, Courier, monospace;">ServiceLocator</span><span style="font-family: Trebuchet MS, sans-serif;"> feature.</span></span></span></div><div><span style="color: #333333;"><span style="line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></span></span></div><div><span style="color: #333333;"><span style="line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;">Please let me know what you think about it.</span></span></span></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><b>Check out the documentation, the examples and the source code:</b></span></div><div style="color: #333333; line-height: 25px;"><a href="https://github.com/DavidVujic/EPiServer-FakeMaker"><span style="font-family: Trebuchet MS, sans-serif;">https://github.com/DavidVujic/EPiServer-FakeMaker</span></a></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><b>You will also find FakeMaker at NuGet:</b></span></div><div style="color: #333333; line-height: 25px;"><a href="https://www.nuget.org/packages/FakeMaker/"><span style="font-family: Trebuchet MS, sans-serif;">https://www.nuget.org/packages/FakeMaker/</span></a></div><div style="color: #333333; font-size: 15px; line-height: 25px;"><br /></div></div>FakeMaker - helping you with test driven EPiServer developmenthttps://davidvujic.blogspot.com/2013/12/fakemaker-helping-you-with-test-driven.html2013-12-30T16:38:00.0000000Z<div style="color: #333333; line-height: 25px; margin-bottom: 15px; margin-top: 15px;"><span style="font-family: Trebuchet MS, sans-serif;">Test driven development <b>and </b>EPiServer?</span></div><div style="color: #333333; line-height: 25px; margin-bottom: 15px; margin-top: 15px;"><span style="font-family: Trebuchet MS, sans-serif;"><b>Relax.</b> Test driving the CMS actually got a whole lot easier with version 7. Most of the built in features are implementing interfaces <b>and</b> you can use asp.net mvc. Those ones are two really good friends of test driven development. </span><span style="font-family: 'Trebuchet MS', sans-serif;">However, creating that fake content and set up mocked repositories isn't really as smooth as it should (could) be, right?</span></div><div style="color: #333333; line-height: 25px; margin-bottom: 15px; margin-top: 15px;"><span style="font-family: Trebuchet MS, sans-serif;">When mocking code is all you see on your screen, this little library called <a href="https://github.com/DavidVujic/EPiServer-FakeMaker" target="_blank">FakeMaker</a> may help you. Okay, a bigger screen also would, but is probably more expensive. </span><span style="font-family: 'Trebuchet MS', sans-serif;">With FakeMaker, you have two classes: FakeMaker and FakePage. The FakeMaker class takes care of the mocking and FakePage helps you create content.</span></div><div style="margin-bottom: 15px; margin-top: 15px;"><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><b>Here's some examples.</b></span></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;">Create an instance of FakeMaker:</span></span><br /><span style="color: #333333; font-family: Courier New, Courier, monospace;"><span style="line-height: 25px;">var fake = new FakeMaker();</span></span><br /><div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;"><br /></span></span></div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;">Create the pages you need:</span></span></div><div><span style="color: #333333; font-family: Courier New, Courier, monospace;"><span style="line-height: 25px;">var page = FakePage.<b>Create</b>("MyPageName");</span></span></div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;"><br /></span></span></div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;">or a page of a specific page type:</span></span></div><div><span style="color: #333333; font-family: Courier New, Courier, monospace;"><span style="line-height: 25px;">FakePage.<b>Create</b><CustomPageData>("MyOtherPageName");</span></span></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div></div><div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;">Add it to the mocked repository:</span></span></div><div><span style="color: #333333;"><span style="line-height: 25px;"><span style="font-family: Courier New, Courier, monospace;">fake.<b>AddToRepository</b>(page)</span><span style="font-family: Trebuchet MS, sans-serif;">;</span></span></span></div><div><span style="color: #333333; font-family: Trebuchet MS, sans-serif;"><span style="line-height: 25px;"><br /></span></span></div><div><span style="color: #333333;"><span style="line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;">You can now pass the fake repository to your code (also known as Dependency Injection) from the </span><span style="font-family: Courier New, Courier, monospace;">ContentRepository</span><span style="font-family: Trebuchet MS, sans-serif;"> property or use the built in EPiServer </span><span style="font-family: Courier New, Courier, monospace;">ServiceLocator</span><span style="font-family: Trebuchet MS, sans-serif;"> feature.</span></span></span></div><div><span style="color: #333333;"><span style="line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></span></span></div><div><span style="color: #333333;"><span style="line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;">Please let me know what you think about it.</span></span></span></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><b>Check out the documentation, the examples and the source code:</b></span></div><div style="color: #333333; line-height: 25px;"><a href="https://github.com/DavidVujic/EPiServer-FakeMaker"><span style="font-family: Trebuchet MS, sans-serif;">https://github.com/DavidVujic/EPiServer-FakeMaker</span></a></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><div style="color: #333333; line-height: 25px;"><span style="font-family: Trebuchet MS, sans-serif;"><b>You will also find FakeMaker at NuGet:</b></span></div><div style="color: #333333; line-height: 25px;"><a href="https://www.nuget.org/packages/FakeMaker/"><span style="font-family: Trebuchet MS, sans-serif;">https://www.nuget.org/packages/FakeMaker/</span></a></div><div style="color: #333333; font-size: 15px; line-height: 25px;"><br /></div></div>Upgrading to EPiServer 7.5 - without the headachehttp://davidvujic.blogspot.com/2013/12/upgrading-to-episerver-75-without.html2013-12-18T23:29:00.0000000Z<span style="font-family: Trebuchet MS, sans-serif;">Earlier today I managed to transform the day from huge #FAIL (with headache) to the good feeling of #SUCCESS (headache gone). Oh, this is not twitter. Sorry, I forgot. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">The project I'm involved in currently, we develop an application with EPiServer 7 (it's actually 7.1 to be precise) and I personally enjoy the product being a lot more testable than ever before. Stay tuned for an upcoming post on test driven development with EPiServer. (and there goes the holidays ... why did I promise that?).</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br />The latest version - 7.5 - was recently released and since we are at the beginning of the project there cannot be a better opportunity for an upgrade. So, we made the decision to at least give it a try.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br />There is an upgrade guide at the EPiServer World site, but I guess there are a couple of scenarios that the team over there did not try out. I have sent them feedback on this and some issues raised here will probably be solved shortly.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">Have a look at <a href="http://world.episerver.com/Documentation/Items/Upgrading/EPiServer-CMS/75/Upgrading/" target="_blank">the upgrade guide</a>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br />I suggest that you follow the upgrade guide along with the stuff I describe here. </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br />Before you start, I recommend that you take a copy of the database and use the copy when upgrading (don't forget to update the connectionstrings configuration file). </span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br />The first impediment I ran into was that the installer failed because the site was using a VPP folder in an external share. Before you run the installer, copy the VPP folder to your local disk and update the episerverframework configuration file.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">If you would wake up in the middle of the night and realize upgrading was a bad move, all you need to do is a rollback of the source code. You only messed up the copy of the database and the local VPP folder. Don't worry.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br />Follow the steps 1-9 in the guide.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br />The following step in the guide is about updating the assembly references. Here is a bug. In our project we have added the assemblies from the EPiServer NuGet feed and to update without the headache this what one need to do: right click the references folder, select "Manage NuGet packages" and navigate to the Installed packages folder. <b>Uninstall </b>the references to "EPiServer.CMS.Core" and "EPiServer.Search".</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br />Next up is where I found the bug: when I browsed the new assemblies in the EPiServer feed and installed them, the reference to <b>StructureMap </b>had the <b>wrong version</b> and the code would not compile. What I did was to install StructureMap from <b>the official NuGet feed</b> first. Then I went back to the EPiServer NuGet feed and installed "EPiServer.CMS.Core" and "EPiServer.Search". The previously installed version of StructureMap was already there and was not overwritten.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-Nflo3YfliF8/UrG_iJ8lbII/AAAAAAAABKk/f64xJpwwHRE/s1600/stucturemap_1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="font-family: Trebuchet MS, sans-serif;"><img border="0" height="191" src="http://3.bp.blogspot.com/-Nflo3YfliF8/UrG_iJ8lbII/AAAAAAAABKk/f64xJpwwHRE/s400/stucturemap_1.png" width="400" /></span></a></td></tr><tr><td class="tr-caption" style="text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;">Here is the version existing in the EPiServer NuGet feed.</span></td></tr></tbody></table><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-kVae0sZcRJ8/UrHAHyo1y0I/AAAAAAAABKs/6ffPjs-9tGk/s1600/stucturemap_2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><span style="font-family: Trebuchet MS, sans-serif;"><img border="0" height="193" src="http://3.bp.blogspot.com/-kVae0sZcRJ8/UrHAHyo1y0I/AAAAAAAABKs/6ffPjs-9tGk/s400/stucturemap_2.png" width="400" /></span></a></td></tr><tr><td class="tr-caption" style="text-align: center;"><span style="font-family: Trebuchet MS, sans-serif;">Here is the newer version from the official NuGet feed.</span></td></tr></tbody></table><span style="font-family: Trebuchet MS, sans-serif;"><br />The solution is ready to be built. Most likely the compilation will fail, because of the breaking changes of the 7.5 version. Step 12 in the guide is about making the source code changes.</span><br /><div><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><div><span style="font-family: Trebuchet MS, sans-serif;">One thing that I find confusing is the code existing in the EPiServer.UI assembly. We have written a custom report in this project and that needed to be updated. The new stuff to use is within the namespace <b>EPiServer.Shell</b>, but the actual assembly is<b> EPiServer.UI</b>. And that assembly isn't referenced when getting the stuff from the EPiServer NuGet feed. So, what did I do? Well, I picked up the local dll from the EPiServer installation folder (the 7.5 folder).</span></div><div><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><div><span style="font-family: Trebuchet MS, sans-serif;">Confusing, isn't it?</span></div><div><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><div><span style="font-family: Trebuchet MS, sans-serif;">Finally, the code actually compiles without any errors. Tadaa!</span></div><div><span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div><div><span style="font-family: Trebuchet MS, sans-serif;">But wait. Don't browse the site! I did that. And it lead me to the wrong problem solving path. Headache. The site should actually not be browsable at this point, and that is fine. So, move on to the next step in the guide and run the update add-ons stuff from the Deployment Center.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">By now, the upgrade is almost done. So close, and yet so far away. The next move is to migrate the VPP files into the new media system. The guide mentions the VPP Migration Tool. But where is it? Guys, <b>a link to the download page</b> from the guide would save us lots of time (and headache). Finally I found the tool at the download page for the CMS 7.5 page (the column to the right with the header "You might also want to download"). </span></div><div><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">Almost done. Don't give up! Have a banana and drink some water.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">It's time to follow another guide: <a href="/link/f71f3cc7fc73450da41b9d1adb3ffbed.aspx">Migrating VPP-based files to the new media system</a>.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">I added the classes GenericMedia, ImageFile and VideoFile. I still am not sure if that really was needed. The guide describes the code as just examples. To be safe I also regenerated the GUIDs with some help from Visual Studio.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><br /><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-dlyaspdhoKA/UrImaXg5pUI/AAAAAAAABLU/fqfXSXuA_Xo/s1600/vs_media.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="167" src="http://2.bp.blogspot.com/-dlyaspdhoKA/UrImaXg5pUI/AAAAAAAABLU/fqfXSXuA_Xo/s400/vs_media.png" width="400" /></a></div><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">The final impediment is the kind of problem that is so simple, but sometimes so difficult to see. I think it's about that tree and the forest, you know? The Migration Tool threw an exception when I tried to connect to the site. The exception was about not being allowed to use external assemblies. "What? Where? Who?"</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">Man, did I google to find a solution. Whew!</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">The executable file itself was blocked by Windows since it was a downloaded file. By right clicking it and selecting properties, the "Unblock" button will appear. <b>Click it</b>. Just do it. Run the Migration Tool again and you will finally be able to tweet #SUCCESS.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">The things described here has been verified in two different virtual machines, one with Windows Server 2012 R2 and the other one with Windows 8.1 Pro.</span><br /><span style="font-family: Trebuchet MS, sans-serif;"><br /></span><span style="font-family: Trebuchet MS, sans-serif;">Good night.</span></div>