Try our conversational search powered by Generative AI!

Chris Banner
Jul 10, 2017
  3720
(1 votes)

What's new in Episerver Social 1.5?

This week brings the release of Episerver Social 1.5. In addition to a handful of internal enhancements and performance tweaks, this version introduces the AnyExpression. 

This new expression allows you to compare a field of your extension data against a set of values, matching documents where the field's value is represented by any within the set.

Consider a scenario where a collection of Comments has been extended with the following sample of extension data:

{ LuckyNumber = 7 }
{ LuckyNumber = 42 }
{ LuckyNumber = 5 }
{ LuckyNumber = 10 }

With the AnyExpression we can now identify those Comments with a LuckyNumber that matches any of a series of values.

var luckyNumberField = FilterExpressionBuilder<MyCommentExtension>.Field(ext => ext.LuckyNumber);
var luckiestComments = luckyNumberField.Any(new long[] { 5, 7, 9 });

var criteria = new CompositeCriteria<Comment, MyCommentExtension>
{                
    ExtensionFilter = luckiestComments 
};

var commentService = ServiceLocator.Current.GetInstance<ICommentService>();
var results = await commentService.GetAsync(criteria);

In the snippet show above, the service will return a set of Comments extended with the lucky numbers 5, 7, or 9. Given our initial sample, this means that we'd receive those comments with: 

{ LuckyNumber = 7 }
{ LuckyNumber = 5 }

This expression can be applied to any Episerver Social feature accepting extension data. For more details, feel free to dig into the developer guide.

Jul 10, 2017

Comments

192.168.l.254 192.168.1.254
192.168.l.254 192.168.1.254 Sep 7, 2018 05:28 PM

192.168.l.254

Please login to comment.
Latest blogs
Blazor in Optimizely CMS 12 with .NET 8

How to enable support for Blazor components in Optimizely CMS 12 after upgrading to .NET 8.

Ted | May 30, 2024 | Syndicated blog

Build a headless blog with Astro and Optimizely SaaS CMS

I’m a big fan of using the right tool for the right job. I’m also a big fan of Astro , for the right use case. Let's explore Astro to see what it's...

Jacob Pretorius | May 28, 2024

Microsoft announces Natural language to SQL

Finally, Microsoft launches "Natural language to SQL," after it has been available for several months in Optimizely CMS!

Tomas Hensrud Gulla | May 23, 2024 | Syndicated blog

Five easy ways to start personalizing your content right now

If you clicked on this article, you already know that getting the right message to the right person at the right time helps drive conversions and...

Kara Andersen | May 23, 2024