Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Lee Crowe
May 1, 2012
  3611
(1 votes)

ElencySolutions.MultipleProperty v1.5.1 Released

A few days ago I released a new version of my multiple property assembly.  The previous version basically allowed you to set a default value for properties and also added some functionality which enabled you to turn on and off various list based buttons such as edit, delete etc.  The button toggling changes came about because of some customizations a colleague of mine had to make for a client.

Unfortunately I made some assumptions about what he was trying to do and didn’t give him what he wanted (note to self do some requirements gathering up front).  So I give you v1.5.1.

New Features/Bug Fixes

  • Copy as new button will no longer allow you to add more items to the list than the set maximum number of items.
  • New IMultiplePropertyEntityAbilityOverride interface.
  • New IMultiplePropertyEntityCollectionAbilityOverride interface.

Making use of the new ability override interfaces

You’re entity classes can now implement the IMultiplePropertyEntityAbilityOverride interface.  The interface has the following methods:

- bool AllowEdit(PageData pageData, string propertyName);
- bool AllowDelete(PageData pageData, string propertyName);

Within your entity you can then define any custom logic to determine whether the edit and delete buttons can be enabled.

For entity collections List<TEntity> you can implement the IMultiplePropertyEntityCollectionAbilityOverride interface.  This interface has the following methods:

- bool AllowAdd(PageData pageData, string propertyName);
- bool AllowEdit(PageData pageData, string propertyName);
- bool AllowDelete(PageData pageData, string propertyName);

This enables you to define custom logic to determine whether add, edit or delete functionality should be enabled across the whole list rather than an individual entity level.

Installation

The easiest way to install the assembly is by installing it from the EPiServer nuget feed (once it has been made available).  But if you are not down with the cool kids you can download it from codeplex.  The assembly is built for EPiServer CMS 6 and onwards.

On the codeplex site you can also find some useful documentation and example code to get you familiar with what the property offers.  The example code is dependent on PageTypeBuilder.

Feedback

As always feedback is greatly appreciated, if you have any suggestions for new features or changes I am happy to hear them.

Just twitter me @croweman or send me an email Smile

May 01, 2012

Comments

May 4, 2012 02:03 PM

Nice one thats just what I was looking for

Jun 11, 2012 03:00 PM

How can I get this one to run under CMS 6 R2? The dll is compiled for an older version op Episerver CMS...

Jun 11, 2012 03:03 PM

Hi Ronald

A standard CMS 6 R2 build will have some assembly binding redirects in the web.config to redirect to the latest version of the assemblies so you should not need to do anything.

If this is a big issue and you need it compiling against CMS 6 R2 you can download the source from codeplex and recompile it.

Lee

Jun 11, 2012 03:35 PM

Hi Lee,

Thanks for the very quick response! What do you mean with the assembly redirects? Could you show me an example how to do that? By default it generates an standard error referring to:

"Could not load file or assembly 'EPiServer, Version=6.0.530.0,....." etc..


Thanks,
Ronald

Jun 11, 2012 03:37 PM

Hi Ronald

Example below, these will be added to your web.config with a default CMS 6 R2 install.













Lee

Jun 11, 2012 03:51 PM

Hmm I already recompiled the DLL and that seems to work. Thanks for this solution as well.
Now when I'm checking the custom properties list, it only shows 'FakeProperty', but not a 'MultipleProperty'. Should I add that one manually?

Thanks again,
Ron.

Jun 11, 2012 03:54 PM

Hi Ronald

FakeProperty is the only out of the box property you get and it is a hack to fix some issues with composer, you never need to directly use it.

To understand how to make use of the assembly please refer to this documentation http://download.codeplex.com/Download?ProjectName=episerveresmp&DownloadId=373655.

The example on the downloads page may also be useful http://episerveresmp.codeplex.com/releases/view/86999 as you can add it to your alloy tech site and get used to it.

Lee

Jun 11, 2012 04:03 PM

Ah ok, so I need to create all the entities and properties through code. And how can I bypass PTB, since I don't want to use it?

Jun 11, 2012 04:12 PM

Hi Ronald

Yep all entities and properties need creating in code.

The example uses PTB but you do not have to use it.

Out of interest why don't you want to use PTB?

Lee

Jun 11, 2012 04:16 PM

We want to have the flexibility to create templates online, not through the code of a programmer. We also had several problems with synchronizing templates (combined with sourcecontrol etc.) so we chose to skip it. I did hear that the new version of Episerver will have similar functionality as PTB.

Jun 11, 2012 04:19 PM

By the way to be able to create templates online, we needed more work, so now we can also generate the other part of the template through use of a Razor syntax, so now we don't need a programmer to create templates. Pretty neat, and one of the things missing, from an otherwise excellent CMS!

Jun 11, 2012 04:30 PM

Anyway, got it to work! Thanks very much.

One very last question, in the documentation it's possible to change the settings through MultiplePropertyEntityAttribute. Things like 'AddButtonText' I would love to use, but am not sure where and how to put this code.

Jun 11, 2012 04:44 PM

You would decorate your entity class with the MultiplePropertyEntityAttribute, this has various properties that can be set.

e.g.

[Serializable]
[DataContract]
[KnownType(typeof(Image))]
[MultiplePropertyEntity(AddButtonText = "Add)]
public class Image
{
}

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog