<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Blog posts by Marthin Freij</title><link href="http://world.optimizely.com" /><updated>2011-01-30T22:11:35.0000000Z</updated><id>https://world.optimizely.com/blogs/Marthin-Freij/</id> <generator uri="http://world.optimizely.com" version="2.0">Optimizely World</generator> <entry><title>Profiling NHibernate or Linq to SQL in an EPiServer CMS solution</title><link href="http://blogg.konstruktor.se/?p=144" /><id>Hibernating Rhinos has two really good products for profiling applications that are using NHibernate or Linq to SQL, NHibernate Profiler and Linq to Sql Profiler. To profile your application you need to reference an appender and initialize it upon startup. This can easily be done in several ways in EPiServer CMS, using HTTP modules, the [...]</id><updated>2011-01-30T22:11:35.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer – ReflectionTypeLoadException: Unable to load one or more of the requested types</title><link href="http://blogg.konstruktor.se/?p=98" /><id>Today I installed Page Type Builder 1.2 Beta 2 on my ongoing EPiServer CMS 6 project. I dropped the Page Type Builder assemblies in the bin folder, recreated the references, did an iisreset and then tried to start the site. I got the following exception: Unable to load one or more of the requested types. [...]</id><updated>2010-04-30T12:29:31.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer - ReflectionTypeLoadException: Unable to load one or more of the requested types</title><link href="https://world.optimizely.com/blogs/Marthin-Freij/Dates/2010/4/EPiServer---ReflectionTypeLoadException-Unable-to-load-one-or-more-of-the-requested-types/" /><id>&lt;p&gt;Today I installed Page Type Builder 1.2 Beta 2 on my ongoing EPiServer CMS 6 project. I dropped the Page Type Builder assemblies in the bin folder, recreated the references, did an iisreset and then tried to start the site. I got the following exception:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Unable to load one or more of the requested types. The following information may be a subset of the Type/LoaderException information present - inspect with debugger for complete view.      &lt;br /&gt;Check assemblies [PageTypeBuilder, Version=1.1.9.1, Culture=neutral, PublicKeyToken=6fb8762af0e6dbed] and/or types [PageTypeBuilder.Reflection.MethodInfoExtensions,       &lt;br /&gt;PageTypeBuilder.Abstractions.PageTypeFactory,       &lt;br /&gt;PageTypeBuilder.Activation.PageTypePropertyInterceptor,       &lt;br /&gt;PageTypeBuilder.Discovery.PageTypeDefinition,       &lt;br /&gt;PageTypeBuilder.Synchronization.PageTypePropertyUpdater,       &lt;br /&gt;PageTypeBuilder.Discovery.PageTypePropertyDefinitionLocator,       &lt;br /&gt;PageTypeBuilder.Initializer,       &lt;br /&gt;PageTypeBuilder.Synchronization.PageTypeUpdater,       &lt;br /&gt;PageTypeBuilder.PageTypeBuilderException,       &lt;br /&gt;PageTypeBuilder.UI.PageDataValidationExtensions,       &lt;br /&gt;PageTypeBuilder.Synchronization.Validation.UnmappablePropertyTypeException,       &lt;br /&gt;PageTypeBuilder.Discovery.PageTypeDefinitionLocator,       &lt;br /&gt;PageTypeBuilder.PageDataExtensionMethods,       &lt;br /&gt;PageTypeBuilder.Activation.PageTypePropertiesProxyGenerationHook,       &lt;br /&gt;PageTypeBuilder.Synchronization.TabDefinitionUpdater,       &lt;br /&gt;PageTypeBuilder.Reflection.AttributedTypesUtility,       &lt;br /&gt;PageTypeBuilder.Discovery.PageTypePropertyDefinition,       &lt;br /&gt;PageTypeBuilder.Synchronization.TabDefinitionExtensions,       &lt;br /&gt;PageTypeBuilder.Synchronization.PageTypeSynchronizer,       &lt;br /&gt;PageTypeBuilder.Synchronization.PageTypePropertyDefinitionExtensions]. Information from LoaderExceptions property [Request for the permission of type &#39;System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&#39; failed.,       &lt;br /&gt;Request for the permission of type &#39;System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&#39; failed.,       &lt;br /&gt;Request for the permission of type &#39;System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&#39; failed.,       &lt;br /&gt;Request for the permission of type &#39;System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&#39; failed.,       &lt;br /&gt;Request for the permission of type &#39;System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&#39; failed.].&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The reason for this exception is Windows 7 security features. When you download assemblies from Internet they might be marked as unsafe. To solve this, right click each assembly, select Properties and click the Unblock button on the General tab.&lt;/p&gt;</id><updated>2010-04-30T11:05:07.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Configuring page provider capabilities</title><link href="https://world.optimizely.com/blogs/Marthin-Freij/Dates/2010/2/Configuring-page-provider-capabilities/" /><id>&lt;p&gt;Page providers requires some configuration. In addition to the obvious ones like name, type and entryPoint you should also define what capabilities your page provider supports, such as Create, Edit, Delete and Search. If you, for example, specify that your provider does not support delete, all delete related ui in edit mode will be disabled for your providers pages. More details on capabilities can be found in the Configuration section of the &lt;a href=&quot;http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-5-R2/Page-Providers/&quot;&gt;Page Provider Tech Note&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In almost all examples I have seen for page provider configuration, capabilities are specified in web.config. In my opinion, capabilities should not be defined in configuration. This could lead to, by accident, specifying more capabilities than what is actually implemented in code. I think the best place for this kind of configuration is code. Fortunately, the Capabilities property in PageProviderBase is virtual, which means you can override it and configure it there.&lt;/p&gt;  &lt;pre&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;override&lt;/span&gt; PageProviderCapabilities Capabilities
{
    &lt;span style=&quot;color: #0000ff&quot;&gt;get&lt;/span&gt;
    {
        &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; PageProviderCapabilities.Create | 
            PageProviderCapabilities.Edit | 
            PageProviderCapabilities.Search;
    }
}&lt;/pre&gt;</id><updated>2010-02-11T22:02:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Problem with constructing PageReferences in Page Providers</title><link href="https://world.optimizely.com/blogs/Marthin-Freij/Dates/2010/2/Problem-with-constructing-PageReferences-in-Page-Providers/" /><id>&lt;p&gt;Recently I have spent some time implementing page providers for a customer. A couple of days ago I noticed that one of the page providers started to behave strange for one particular PageId. The PageReference for that page had RemoteSite set to null instead of the page providers ProviderKey. This means that the PageReference will point on a page in the LocalPageProvider rather than on my page in my custom page provider. After some investigation it was clear that this particular PageReference was equal to the PageReference of the page providers EntryPoint.&lt;/p&gt;  &lt;p&gt;The problem seemed to be related to constructing the PageReference which was handled by the PageProviderBase.ConstructPageReference methods. Reflecting these methods with Reflector made it clear that PageReferences are constructed with RemoteSite set to ProviderKey only if PageId is not equal to EntryPoint.ID. The workaround is to construct the PageReference yourself and always set the ProviderKey part. Be careful though when you are constructing ParentLink for top-level pages because it in these cases is located on the LocalPageProvider.&lt;/p&gt;</id><updated>2010-02-08T11:30:49.0000000Z</updated><summary type="html">Blog post</summary></entry></feed>