Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

valdis
May 16, 2012
  3300
(0 votes)

Limit assemblies for scanning for Community Entity Attributes (v0.3)

If you are working with EPiServer Relate+ product then you know that there is a extendable entities in the framework that allows you to add new attributes to existing entities to store some additional info if required.

 

Default approach to set and get values from those attributes are using stringly-typed interface, like:

 

  1. return user.GetAttributeValue<string>("SkypeUsername");

 

To get rid of this and to access entity in strongly-typed manner can be accomplished either using:

  1. CustomEntityProvider
  2. Or by using some custom interceptors.

 

Later one is implemented in Geta.Community.EntityAttributeBuilder library. Using this lib you can get access to entities attributes in following manner:

 

  1. var userAttr = user.AsAttributeExtendable<UserAttributes>();
  2. userAttr.FatherName = "John";

 

Library had to scan all the assemblies in current application domain and look for particular types decorated with known attributes for Geta.Community.EntityAttributeBuilder.

Building and using this library in a large projects where assemblies may reach up to 250 and more may cause some startup delays as it was scanning everything and trying to sync attributes. Usually such meta data is stored in few assemblies and no need for extra all assemblies scanning process to find ones.

 

Latest version of Geta.Community.EntityAttributeBuilder library (0.3) is released with feature that limits scanning process to known list of assemblies. One that you can found in <episerver.framework> element <scanAssembly>.

 

So using latest version you can now configure to limit scanning. Add this to your configuration file:

 

  1. <configSections>
  2.   <section name="entityAttributeBuilder" type="Geta.Community.EntityAttributeBuilder.EntityAttributeBuilderConfiguration, Geta.Community.EntityAttributeBuilder" />
  3. </configSections>

 

Add add configuration section:

 

  1. <entityAttributeBuilder>
  2.   <scanAssembly>
  3.     <add assembly="YourAssemblyNameWhereAttributesAreLocated" />
  4.     <add assembly="YourAnotherAssemblyName" />
  5.   </scanAssembly>
  6. </entityAttributeBuilder>

 

Package as usual can be found in nuget.episerver.com (Id: Geta.Community.EntityAttributeBuilder).

 

 

Hope this helps!

May 16, 2012

Comments

valdis
valdis May 16, 2012 01:53 PM

For the site with approx 200 assemblies startup time increased by ~1 sec.

Please login to comment.
Latest blogs
Stop Managing Humans in Your CMS

Too many times, a content management system becomes a people management system. Meaning, an organization uses the CMS to manage all the information...

Deane Barker | Nov 30, 2023

A day in the life of an Optimizely Developer - Optimizely CMS 12: The advantages and considerations when exploring an upgrade

GRAHAM CARR - LEAD .NET DEVELOPER, 28 Nov 2023 In 2022, Optimizely released CMS 12 as part of its ongoing evolution of the platform to help provide...

Graham Carr | Nov 28, 2023

A day in the life of an Optimizely Developer - OptiUKNorth Meetup January 2024

It's time for another UK North Optimizely meet up! After the success of the last one, Ibrar Hussain (26) and Paul Gruffydd (Kin + Carta) will be...

Graham Carr | Nov 28, 2023

Publish content to Optimizely CMS using a custom GPT from OpenAI 🤖

Do you find the traditional editor interface complicated and cluttered? Would you like an editorial AI assistant you can chat with? You can!

Tomas Hensrud Gulla | Nov 28, 2023 | Syndicated blog