Is Vandelay.Industries Ok ?

Topics: Troubleshooting, Writing modules
Dec 13, 2013 at 1:56 PM
Edited Dec 13, 2013 at 2:30 PM
I use Orchard 1.x branch and Vandelay last version
got strange error :Image


'string' does not contain a definition for 'TagName' and no extension method 'TagName' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) ~\src\Orchard.Web\Modules\Vandelay.Industries\Services\TagCloudService.cs
                                     tagCounts = _contentManager
                                          .Query<TagsPart, TagsPartRecord>(VersionOptions.Published)
                                          .Join<CommonPartRecord>()
                                          .Where(t => t.Container.Id == container.Id)
                                          .List()
                                          .SelectMany(t => t.CurrentTags)
                                          .GroupBy(t => t.TagName)
                                          .Select(g => new TagCount {
                                              TagName = g.Key,
                                              Count = g.Count()
                                          })
                                          .ToList();
 
t is string instead of TagRecord
.GroupBy(t => t.TagName)
Everything is Ok in Orchard 1.72
Dec 13, 2013 at 2:48 PM
~\src\Orchard.Web\Modules\Orchard.Tags\Models\TagsPart.cs is changed :

1.72 :
using System.Collections.Generic;
using System.Linq;
using Orchard.ContentManagement;

namespace Orchard.Tags.Models {
    public class TagsPart : ContentPart<TagsPartRecord> {
        public IEnumerable<TagRecord> CurrentTags { get { return Record.Tags.Select(t => t.TagRecord); } }
    }
}
and 1.x with funky shift :
using System;
using System.Collections.Generic;
using Orchard.ContentManagement;

namespace Orchard.Tags.Models {
    public class TagsPart : ContentPart<TagsPartRecord> {
        public IEnumerable<string> CurrentTags {
            get { return ParseTags(Retrieve<string>("CurrentTags")); }
            set { Store("CurrentTags", String.Join(",", value)); }
        }

        private IEnumerable<string> ParseTags(string tags) {
            return (tags ?? "").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        }
    }
}
Is it exist fixed Vandelay version ?
Coordinator
Dec 17, 2013 at 12:00 AM
Yes. The fix is extremely simple: just remove the .tagName.

https://vandelay.codeplex.com/SourceControl/changeset/0767af7a1427
Dec 17, 2013 at 2:41 PM
BertrandLeRoy wrote:
Yes. The fix is extremely simple: just remove the .tagName.

https://vandelay.codeplex.com/SourceControl/changeset/0767af7a1427
Ok, Thanks.