Close

Profile: kev83

Avatar

User posts

Yep, that is correct.
I worked out a solution with an ActionFilter and it works fine.

Thank you very much!

kev83 wrote:
Oh, and about the error. It is a strange thing isn't it? I'm trying to build against the 3.5.2 nuget assemblies, but that should be the same thing right?


I meant 5.2.3.

I need some coffee

Oh, and about the error. It is a strange thing isn't it? I'm trying to build against the 3.5.2 nuget assemblies, but that should be the same thing right?

I can reference pretty much anything in the 7Spikes assembly, ecxept for all things mvc related (i.e. Controllers and the like). Maybe it has something to do with the obfuscation that is applied to the assembly?

Ah yes of course, Action filters, why didn't I think of that? I'm going to try it out right away.

Thanks for the tip! 

We created a custom CatalogController which returns a specific custom model. This works fine, until we try to use Nop Ajax Filters, because an incorrect model is returned by getFilteredProducts. So I thought, I'll just create a wrapper for Catalog7SpikesController, change the route in the view and be done with it. 

I had in mind something like this:


public partial class StrelliCatalog7SpikesController : BasePublicController {




  private readonly Catalog7SpikesController _catalog7SpikesController;




  public StrelliCatalog7SpikesController(
    ICategoryService categoryService,
    //... omitted for brevity ...//
    ICacheManager cacheManager,
    IProductServiceNopAjaxFilters productServiceNopAjaxFilters,
    IPriceCalculationServiceNopAjaxFilters priceCalculationServiceNopAjaxFilters,
    IFiltersPageHelper filtersPageHelper,
    NopAjaxFiltersSettings nopAjaxFiltersSettings,
    IQueryStringBuilder queryStringBuilder,
    IQueryStringToModelUpdater queryStringToModelUpdater,
    ICategoryService7Spikes categoryService7Spikes
  ) {
    _catalog7SpikesController = new Catalog7SpikesController(
      categoryService, //... omitted for brevity ...//
      cacheManager, productServiceNopAjaxFilters, priceCalculationServiceNopAjaxFilters,
      filtersPageHelper, nopAjaxFiltersSettings, queryStringBuilder, queryStringToModelUpdater,
      categoryService7Spikes
    );
  }




  public ActionResult GetFilteredProducts(
    int categoryId, int manufacturerId, int vendorId,
    PriceRangeFilterModel7Spikes priceRangeFilterModel7Spikes,
    SpecificationFilterModel7Spikes specificationFiltersModel7Spikes,
    AttributeFilterModel7Spikes attributeFiltersModel7Spikes,
    ManufacturerFilterModel7Spikes manufacturerFiltersModel7Spikes,
    VendorFilterModel7Spikes vendorFiltersModel7Spikes, CatalogPagingFilteringModel pagingFilteringModel,
    OnSaleFilterModel7Spikes onSaleFilterModel, string queryString, bool shouldNotStartFromFirstPage,
    string keyword, int searchCategoryId, int searchManufacturerId, decimal? priceFrom, decimal? priceTo,
    bool includeSubcategories, bool searchInProductDescriptions, bool advancedSearch, bool isOnSearchPage
  ) {
    var result = _catalog7SpikesController.GetFilteredProducts(
      categoryId, manufacturerId, vendorId, priceRangeFilterModel7Spikes,
      specificationFiltersModel7Spikes, attributeFiltersModel7Spikes,
      manufacturerFiltersModel7Spikes, vendorFiltersModel7Spikes,
      pagingFilteringModel, onSaleFilterModel, queryString,
      shouldNotStartFromFirstPage, keyword, searchCategoryId,
      searchManufacturerId, priceFrom, priceTo, includeSubcategories,
      searchInProductDescriptions, advancedSearch, isOnSearchPage
    );  
    // Add our own stuff to the results and return them
  }
}


Only I cannot compile this. The compiler tells me: 

Assembly 'SevenSpikes.Nop.Plugins.AjaxFilters' with identity 'SevenSpikes.Nop.Plugins.AjaxFilters, Version=3.7.186.18875, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=65535.65535.65535.65535, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc' with identity 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Eventhough I'm pretty sure SevenSpikes.Nop.Plugins.AjaxFilters was compiled with System.Web.Mvc 5.2.3.0 (at least according to dotPeek), I can't seem to reference it.

I tried this in the web.config:


<dependentAssembly>
  <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
  <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.2.3.0"/>
</dependentAssembly>
 

To no avail.

Any thoughts on how I can solve this, or work around it? Or is what I am trying to do totally illegal?