+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Upgrade from 3.2 SP1 to 3.7 SP3: Problem with Custom Library Provider

Upgrade from 3.2 SP1 to 3.7 SP3: Problem with Custom Library Provider

9 posts, 0 answered
  1. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    31 Mar 2010
    Link to this post

    I just upgraded to the latest version, but have an issue with our CustomLibraryProvider.  Please see the error message below.  I took a look at the GetAllLibraries method in the API (http://www.sitefinity.com/help/developer-manual/telerik.libraries-telerik.libraries.ilibraryprovider-getalllibraries.html) and it only has 4 parameters.  Looks like the new version is expecting 5 and the API need updating.  What's the name of this parameter? 

    Old: GetAllLibraries(int, int, ref int, string, string)
    New: GetAllLibraries(int, int, ref int, string, string, bool).

    Thanks for your help!
    J

    Server Error in '/' Application.


    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0535: 'CustomLibraryProvider' does not implement interface member 'Telerik.Libraries.ILibraryProvider.GetAllLibraries(int, int, ref int, string, string, bool)'

    Source Error:


     

    Line 28: /// Summary description for CustomLibraryProvider

    Line 29: /// </summary>

    Line 30: public class CustomLibraryProvider : Telerik.Cms.Engine.Data.Providers.DefaultProvider, ILibraryProvider

    Line 31: {

    Line 32:     /// <summary>


    Source File: d:\share\webroot\cms\App_Code\CustomLibraryProvider.cs    Line: 30


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    31 Mar 2010
    Link to this post
    Hi Jason M,

    Below are all overloads that you can use

    GetAllLibraries();
    GetAllLibraries(string SortExpression);
    GetAllLibraries(string TypeName, bool isEqual);
    GetAllLibraries(int from, int max, string SortExpression);
    GetAllLibraries(int from, int max, string SortExpression, string TypeName, bool isEqual);

    Sort expression - you can get all libraries by passing a property of ILibrary object in a sorted order
    TypeName - it could be Image, Document, Video, Custom
    int from - starting item in the list
    int max - max items in the list
    isEqual - if set to true returns the libraries for the specified type, otherwise inversion.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    31 Mar 2010
    Link to this post
    Thanks for the quick reply!!  Looks like I'm also missing the following:
    - Compiler Error Message: CS0535: 'CustomLibraryProvider' does not implement interface member 'Telerik.Libraries.ILibraryProvider.GetAllLibraries(int, int, ref int, string, string, bool)'
    - Compiler Error Message: CS0535: 'CustomLibraryProvider' does not implement interface member 'Telerik.Libraries.ILibraryProvider.GetImages(int, int, string, string, System.Guid[], Telerik.Cms.Engine.IMetaSearchInfo[])'

    I added the above GeAllLibraries method, What do I need for the parameter name for Telerik.Cms.Engine.IMetaSearchInfo[]?

    I currently have the following:
    public IList GetImages(int from, int max, string sortExp, Guid[] parentIDs)

    J
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    31 Mar 2010
    Link to this post
    Hello Jason M,

    Below is a bare -bone implementation with all required methods to run the module under Sitefinity 3.7 SP3. You can observe the implementation and made the changes in your provider.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Libraries;
    using Telerik.Libraries.Data;
    using Telerik.Cms.Engine;
     
    /// <summary>
    /// Summary description for LibrariesDataProviderCustom
    /// </summary>
    public class LibrariesDataProviderCustom : Telerik.Cms.Engine.Data.Providers.DefaultProvider, ILibraryProvider
    {
        public LibrariesDataProviderCustom()
        {
     
        }
     
        public override string ContentItemKey
        {
            get
            {
                return "GalleryItem";
            }
        }
     
        public override string ContentProviderKey
        {
            get
            {
                return "GalleryProv";
            }
        }
     
        #region ILibraryProvider Members
     
        public virtual void SaveLibrary(ILibrary library)
        {
        }
     
        public ILibrary CreateLibrary()
        {
            Library library = new Library();
            library.Application = this.Application;
            return library;
        }
     
        public System.Collections.IList GetAllLibraries()
        {
            return GetAllLibraries(String.Empty);
        }
     
        public System.Collections.IList GetAllLibraries(string sortExpr)
        {
            Libraries query = new Libraries();
            return query;
        }
     
        public System.Collections.IList GetAllLibraries(int from, int max, ref int count, string sortExp)
        {
            Libraries query = new Libraries();
            return query;
        }
     
        public System.Collections.IList GetAllLibraries(string typeName, bool isEqual)
        {
            Libraries query = new Libraries();
            return query;
        }
     
        public System.Collections.IList GetAllLibraries(int from, int max, ref int count, string sortExp, string typeName, bool isEqual)
        {
            Libraries query = new Libraries();
            return query;
        }
     
        public virtual void DeleteLibrary(ILibrary library)
        {
            
        }
     
        public virtual void DeleteLibrary(Guid ID)
        {
             
        }
     
        public ILibrary GetLibrary(Guid libraryID)
        {
            Library lib = new Library();
            return lib;
        }
     
        public ILibrary GetLibrary(string name)
        {
            Library lib = new Library();
            return lib;
        }
     
        public int GetLibrariesCount()
        {
            return GetLibrariesCountVal;
        }
     
        public System.Collections.IList GetImages(int from, int max, string sortExp, Guid[] parentIDs)
        {
            return this.GetContent(from, max, sortExp, String.Empty, null, parentIDs);
        }
     
        public System.Collections.IList GetImages(int from, int max, string sortExp, string tagName, Guid[] parentIDs, Telerik.Cms.Engine.IMetaSearchInfo[] filter)
        {
            return this.GetContent(from, max, sortExp, String.Empty, null, parentIDs, new IMetaSearchInfo[] {});
        }
     
        public int ImagesCount(Guid parentID)
        {
            return this.ContentCount(null, new Guid[] { parentID }, new IMetaSearchInfo[] { });
        }
     
        public System.Collections.IList GetDocuments(int from, int max, string sortExp, Guid[] parentIDs)
        {
            return this.GetContent(from, max, sortExp, String.Empty, null, parentIDs);
        }
     
        public System.Collections.IList GetDocuments(int from, int max, string sortExp, string tagName, Guid[] parentIDs, Telerik.Cms.Engine.IMetaSearchInfo[] filter)
        {
            return this.GetContent(from, max, sortExp, String.Empty, null, parentIDs, new IMetaSearchInfo[] { });
        }
     
        public int DocumentsCount(Guid parentID)
        {
            return this.ContentCount(null, new Guid[] { parentID }, new IMetaSearchInfo[] { });
        }
     
        public System.Collections.IList GetRawContent(int from, int max, string sortExp, Guid[] parentIDs)
        {
            return this.GetContent(from, max, sortExp, String.Empty, null, parentIDs);
        }
     
        public System.Collections.IList GetRawContent(int from, int max, string sortExp, string tagName, Guid[] parentIDs, Telerik.Cms.Engine.IMetaSearchInfo[] filter)
        {
            return this.GetContent(from, max, sortExp, String.Empty, null, parentIDs, new IMetaSearchInfo[] { });
        }
     
        public int RawContentCount(Guid parentID)
        {
            return this.ContentCount(null, new Guid[] { parentID });
        }
     
        int GetLibrariesCountVal= 0;
     
        #endregion
    }


    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    01 Apr 2010
    Link to this post
    Thanks!  I was missing another 6.  However, I'm not getting the following message:

    Compiler Error Message: CS1729: 'Telerik.ExecutedEventArgs' does not contain a constructor that takes '2' arguments

    Source Error:

    Line 324:        }
    Line 325:        tran.Commit();
    Line 326: this.OnExecuted(new ExecutedEventArgs("SaveLibrary", library));Line 327:    }
    Line 328:
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Apr 2010
    Link to this post
    Hello Jason M,

    There is only one argument

    protected internal void OnExecuted(ExecutedEventArgs args)
      {
          this.OnExecuted(args, true);
      }

    If you want to pass some additional parameters you could call

    this.OnExecuted(new ExecutedEventArgs("SaveLibrary", library.ID, typeof(ILibrary), library));


    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    01 Apr 2010
    Link to this post

    Thanks again for your help!  Still having an issue with this.  I get the error  below.  Looks like I can't overide Telerik.ExecutedEventArgs.  Should I open a support ticket and send you my source code?  Seems like quite a few things have changed from 3.2 to 3.7 and I can't seem to find the required documentation in the API.  We use our CustomLibraryProvider to add security to the Libraries.

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0506: 'CustomLibraryProvider.OnExecuted(Telerik.ExecutedEventArgs)': cannot override inherited member 'Telerik.Cms.Engine.Data.Providers.DefaultProvider.OnExecuted(Telerik.ExecutedEventArgs)' because it is not marked virtual, abstract, or override

    Source Error:

    Line 1030:    //}
    Line 1031:
    Line 1032: protected override void OnExecuted(ExecutedEventArgs args)Line 1033:    {
    Line 1034:        this.OnExecuted(args, true);

  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Apr 2010
    Link to this post
    Hi Jason M,

    As you can see the class is internal.Internal types or members are accessible only within files in the same assembly,

    Your code fails on
     this.OnExecuted(new ExecutedEventArgs("SaveLibrary", library));


    so you should use
    this.OnExecuted(new ExecutedEventArgs("SaveLibrary", library.ID, typeof(ILibrary), library));



    Version 3.2 is almost 3 years old and it is normal to see some changes in the API.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  9. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    01 Apr 2010
    Link to this post
    I agree with you 100% on 3.2 being an older version.  We've had other projects in the pipeline and finally have time to upgrade.  We're definitely excited about new features (Wiki, Admin Performance, dynamic links, etc) and bug fixes in 3.7 SP3.  I'm also very keen to get my hands on 4.0!

    However, a deal breaker for us is the ability to assign security to Libraries.  We need this so we can protect documents in the restricted section of our site.  I believe Georgi provided us with the base implementation and we customized it based on the roles and Libraries.  I'll submit the source code to you in a support ticket and will reference this forum post.  We also don't mind paying extra consulting fees for this customization.  I'd rather pay the experts then guess and make changes that affect performance.

    Thanks again for all your help on this!
    J
Register for webinar
9 posts, 0 answered