Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

TypeConverterRegistrationStartUpTask.cs

using System.ComponentModel;
using Nop.Core.ComponentModel;
using Nop.Core.Domain.Shipping;
using Nop.Core.Infrastructure;

namespace Nop.Core;

/// 
/// Startup task for the registration custom type converters
/// 
public partial class TypeConverterRegistrationStartUpTask : IStartupTask
{
    /// 
    /// Executes a task
    /// 
    public void Execute()
    {
        //lists
        TypeDescriptor.AddAttributes(typeof(List), new TypeConverterAttribute(typeof(GenericListTypeConverter)));
        TypeDescriptor.AddAttributes(typeof(List), new TypeConverterAttribute(typeof(GenericListTypeConverter)));
        TypeDescriptor.AddAttributes(typeof(List), new TypeConverterAttribute(typeof(GenericListTypeConverter)));

        //dictionaries
        TypeDescriptor.AddAttributes(typeof(Dictionary), new TypeConverterAttribute(typeof(GenericDictionaryTypeConverter)));

        //shipping option
        TypeDescriptor.AddAttributes(typeof(ShippingOption), new TypeConverterAttribute(typeof(ShippingOptionTypeConverter)));
        TypeDescriptor.AddAttributes(typeof(List), new TypeConverterAttribute(typeof(ShippingOptionListTypeConverter)));
        TypeDescriptor.AddAttributes(typeof(IList), new TypeConverterAttribute(typeof(ShippingOptionListTypeConverter)));

        //pickup point
        TypeDescriptor.AddAttributes(typeof(PickupPoint), new TypeConverterAttribute(typeof(PickupPointTypeConverter)));
    }

    /// 
    /// Gets order of this startup task implementation
    /// 
    public int Order => 1;
}