Views: 2374
Number of votes: 1
Average rating:

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

    (By Mike Hook , 04 May 2012 14:03, Permanent link)

    Nice one thats just what I was looking for

    Post by harra
    (By harra , 11 June 2012 15:00, Permanent link)

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

    (By Lee Crowe , 11 June 2012 15:03, Permanent link)

    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

    (By harra , 11 June 2012 15:35, Permanent link)

    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

    (By Lee Crowe , 11 June 2012 15:37, Permanent link)

    Hi Ronald

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

    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="EPiServer.ApplicationModules" publicKeyToken="8fe83dea738b45b7" culture="neutral" />
    <bindingRedirect oldVersion="1.0.0.0-6.2.267.1" newVersion="6.2.267.1" />
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="EPiServer.Data.Cache" publicKeyToken="8fe83dea738b45b7" culture="neutral" />
    <bindingRedirect oldVersion="1.0.0.0-6.2.267.1" newVersion="6.2.267.1" />
    </dependentAssembly>
    </runtime>

    Lee

    (By harra , 11 June 2012 15:51, Permanent link)

    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.

    (By Lee Crowe , 11 June 2012 15:54, Permanent link)

    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

    (By harra , 11 June 2012 16:03, Permanent link)

    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?

    (By Lee Crowe , 11 June 2012 16:12, Permanent link)

    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

    (By harra , 11 June 2012 16:16, Permanent link)

    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.

    (By harra , 11 June 2012 16:19, Permanent link)

    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!

    (By harra , 11 June 2012 16:30, Permanent link)

    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.

    (By Lee Crowe , 11 June 2012 16:44, Permanent link)

    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 post a comment