Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/nopSolutions/nopCommerce
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
skoshelev committed Jul 9, 2018
2 parents eeebba6 + 4400019 commit 87bdef7
Show file tree
Hide file tree
Showing 24 changed files with 96 additions and 127 deletions.
13 changes: 3 additions & 10 deletions src/Libraries/Nop.Core/Caching/MemoryCacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public partial class MemoryCacheManager : ILocker, IStaticCacheManager
{
#region Fields

private readonly IMemoryCache _cache;

/// <summary>
/// All keys of cache
/// </summary>
/// <remarks>Dictionary value indicating whether a key still exists in cache</remarks>
protected static readonly ConcurrentDictionary<string, bool> _allKeys;

private readonly IMemoryCache _cache;

/// <summary>
/// Cancellation token for clear cache
/// </summary>
Expand All @@ -32,18 +32,11 @@ public partial class MemoryCacheManager : ILocker, IStaticCacheManager

#region Ctor

/// <summary>
/// Ctor
/// </summary>
static MemoryCacheManager()
{
_allKeys = new ConcurrentDictionary<string, bool>();
}

/// <summary>
/// Ctor
/// </summary>
/// <param name="cache">Cache</param>
public MemoryCacheManager(IMemoryCache cache)
{
_cache = cache;
Expand Down Expand Up @@ -140,7 +133,7 @@ private void PostEviction(object key, object value, EvictionReason reason, objec
#endregion

#region Methods

/// <summary>
/// Get a cached item. If it's not in the cache yet, then load and cache it
/// </summary>
Expand Down
7 changes: 2 additions & 5 deletions src/Libraries/Nop.Core/Caching/PerRequestCacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public partial class PerRequestCacheManager : ICacheManager

#region Ctor

/// <summary>
/// Gets a key/value collection that can be used to share data within the scope of this request
/// </summary>
public PerRequestCacheManager(IHttpContextAccessor httpContextAccessor)
{
this._httpContextAccessor = httpContextAccessor;
Expand Down Expand Up @@ -56,7 +53,7 @@ public virtual T Get<T>(string key, Func<T> acquire, int? cacheTime = null)
var items = GetItems();
if (items == null)
return acquire();

//item already is in cache, so return it
if (items[key] != null)
return (T)items[key];
Expand Down Expand Up @@ -151,4 +148,4 @@ public virtual void Dispose()

#endregion
}
}
}
9 changes: 2 additions & 7 deletions src/Libraries/Nop.Core/Caching/RedisCacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,15 @@ public partial class RedisCacheManager : IStaticCacheManager

private readonly ICacheManager _perRequestCacheManager;
private readonly IRedisConnectionWrapper _connectionWrapper;

private readonly IDatabase _db;

#endregion

#region Ctor

/// <summary>
/// Ctor
/// </summary>
/// <param name="perRequestCacheManager">Cache manager</param>
/// <param name="connectionWrapper">ConnectionW wrapper</param>
/// <param name="config">Config</param>
public RedisCacheManager(ICacheManager perRequestCacheManager,
IRedisConnectionWrapper connectionWrapper,
IRedisConnectionWrapper connectionWrapper,
NopConfig config)
{
if (string.IsNullOrEmpty(config.RedisCachingConnectionString))
Expand Down
7 changes: 2 additions & 5 deletions src/Libraries/Nop.Core/Caching/RedisConnectionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@ public class RedisConnectionWrapper : IRedisConnectionWrapper, ILocker
#region Fields

private readonly NopConfig _config;
private readonly Lazy<string> _connectionString;

private readonly object _lock = new object();
private volatile ConnectionMultiplexer _connection;
private readonly Lazy<string> _connectionString;
private volatile RedLockFactory _redisLockFactory;

#endregion

#region Ctor

/// <summary>
/// Ctor
/// </summary>
/// <param name="config">Config</param>
public RedisConnectionWrapper(NopConfig config)
{
this._config = config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public class GenericDictionaryTypeConverter<K, V> : TypeConverter
/// </summary>
protected readonly TypeConverter typeConverterValue;

/// <summary>
/// Ctor
/// </summary>
public GenericDictionaryTypeConverter()
{
typeConverterKey = TypeDescriptor.GetConverter(typeof(K));
Expand Down Expand Up @@ -61,7 +58,7 @@ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceT
/// <returns>Result</returns>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (!(value is string))
if (!(value is string))
return base.ConvertFrom(context, culture, value);

var input = (string)value;
Expand All @@ -71,12 +68,12 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
Array.ForEach(items, s =>
{
var keyValueStr = string.IsNullOrEmpty(s) ? new string[0] : s.Split(',').Select(x => x.Trim()).ToArray();
if (keyValueStr.Length != 2)
if (keyValueStr.Length != 2)
return;

object dictionaryKey = (K)typeConverterKey.ConvertFromInvariantString(keyValueStr[0]);
object dictionaryValue = (V)typeConverterValue.ConvertFromInvariantString(keyValueStr[1]);
if (dictionaryKey == null || dictionaryValue == null)
if (dictionaryKey == null || dictionaryValue == null)
return;

if (!result.ContainsKey((K)dictionaryKey))
Expand All @@ -96,11 +93,11 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c
/// <returns>Result</returns>
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType != typeof(string))
if (destinationType != typeof(string))
return base.ConvertTo(context, culture, value, destinationType);

var result = string.Empty;
if (value == null)
if (value == null)
return result;

//we don't use string.Join() because it doesn't support invariant culture
Expand All @@ -118,4 +115,4 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
return result;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ public class GenericListTypeConverter<T> : TypeConverter
/// </summary>
protected readonly TypeConverter typeConverter;

/// <summary>
/// Ctor
/// </summary>
public GenericListTypeConverter()
{
typeConverter = TypeDescriptor.GetConverter(typeof(T));
Expand Down Expand Up @@ -47,7 +44,7 @@ protected virtual string[] GetStringArray(string input)
/// <returns>Result</returns>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType != typeof(string))
if (sourceType != typeof(string))
return base.CanConvertFrom(context, sourceType);

var items = GetStringArray(sourceType.ToString());
Expand All @@ -63,7 +60,7 @@ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceT
/// <returns>Result</returns>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (!(value is string))
if (!(value is string))
return base.ConvertFrom(context, culture, value);

var items = GetStringArray((string)value);
Expand Down Expand Up @@ -94,7 +91,7 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
return base.ConvertTo(context, culture, value, destinationType);

var result = string.Empty;
if (value == null)
if (value == null)
return result;

//we don't use string.Join() because it doesn't support invariant culture
Expand All @@ -110,4 +107,4 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul
return result;
}
}
}
}
3 changes: 0 additions & 3 deletions src/Libraries/Nop.Core/Domain/Catalog/CatalogSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ namespace Nop.Core.Domain.Catalog
/// </summary>
public class CatalogSettings : ISettings
{
/// <summary>
/// Ctor
/// </summary>
public CatalogSettings()
{
ProductSortingEnumDisabled = new List<int>();
Expand Down
3 changes: 0 additions & 3 deletions src/Libraries/Nop.Core/Domain/Cms/WidgetSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ namespace Nop.Core.Domain.Cms
/// </summary>
public class WidgetSettings : ISettings
{
/// <summary>
/// Ctor
/// </summary>
public WidgetSettings()
{
ActiveWidgetSystemNames = new List<string>();
Expand Down
3 changes: 0 additions & 3 deletions src/Libraries/Nop.Core/Domain/Common/CommonSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ namespace Nop.Core.Domain.Common
/// </summary>
public class CommonSettings : ISettings
{
/// <summary>
/// Ctor
/// </summary>
public CommonSettings()
{
SitemapCustomUrls = new List<string>();
Expand Down
9 changes: 3 additions & 6 deletions src/Libraries/Nop.Core/Domain/Configuration/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ namespace Nop.Core.Domain.Configuration
/// </summary>
public partial class Setting : BaseEntity, ILocalizedEntity
{
/// <summary>
/// Ctor
/// </summary>
public Setting()
{
}
Expand All @@ -20,13 +17,13 @@ public Setting()
/// <param name="name">Name</param>
/// <param name="value">Value</param>
/// <param name="storeId">Store identifier</param>
public Setting(string name, string value, int storeId = 0)
public Setting(string name, string value, int storeId = 0)
{
this.Name = name;
this.Value = value;
this.StoreId = storeId;
}

/// <summary>
/// Gets or sets the name
/// </summary>
Expand All @@ -51,4 +48,4 @@ public override string ToString()
return Name;
}
}
}
}
5 changes: 1 addition & 4 deletions src/Libraries/Nop.Core/Domain/Customers/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public partial class Customer : BaseEntity
private ICollection<ReturnRequest> _returnRequests;
protected ICollection<CustomerAddressMapping> _customerAddressMappings;
private IList<CustomerRole> _customerRoles;

/// <summary>
/// Ctor
/// </summary>

public Customer()
{
this.CustomerGuid = Guid.NewGuid();
Expand Down
3 changes: 0 additions & 3 deletions src/Libraries/Nop.Core/Domain/Customers/CustomerPassword.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ namespace Nop.Core.Domain.Customers
/// </summary>
public partial class CustomerPassword : BaseEntity
{
/// <summary>
/// Ctor
/// </summary>
public CustomerPassword()
{
this.PasswordFormat = PasswordFormat.Clear;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ namespace Nop.Core.Domain.Messages
/// </summary>
public class AdditionTokensAddedEvent
{
/// <summary>
/// Ctor
/// </summary>
public AdditionTokensAddedEvent()
{
this.AdditionTokens = new List<string>();
Expand Down
3 changes: 0 additions & 3 deletions src/Libraries/Nop.Core/Domain/Payments/PaymentSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ namespace Nop.Core.Domain.Payments
/// </summary>
public class PaymentSettings : ISettings
{
/// <summary>
/// Ctor
/// </summary>
public PaymentSettings()
{
ActivePaymentMethodSystemNames = new List<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ namespace Nop.Core.Domain.Security
/// </summary>
public class DefaultPermissionRecord
{
/// <summary>
/// Ctor
/// </summary>
public DefaultPermissionRecord()
public DefaultPermissionRecord()
{
this.PermissionRecords = new List<PermissionRecord>();
}
Expand All @@ -25,4 +22,4 @@ public DefaultPermissionRecord()
/// </summary>
public IEnumerable<PermissionRecord> PermissionRecords { get; set; }
}
}
}
5 changes: 1 addition & 4 deletions src/Libraries/Nop.Core/Domain/Shipping/ShippingSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ namespace Nop.Core.Domain.Shipping
/// </summary>
public class ShippingSettings : ISettings
{
/// <summary>
/// Ctor
/// </summary>
public ShippingSettings()
{
ActiveShippingRateComputationMethodSystemNames = new List<string>();
Expand Down Expand Up @@ -46,7 +43,7 @@ public ShippingSettings()
/// Gets or sets Google map API key
/// </summary>
public string GoogleMapsApiKey { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the system should use warehouse location when requesting shipping rates
/// This is useful when you ship from multiple warehouses
Expand Down
8 changes: 2 additions & 6 deletions src/Libraries/Nop.Core/Http/InstallUrlMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ public class InstallUrlMiddleware

#region Ctor

/// <summary>
/// Ctor
/// </summary>
/// <param name="next">Next</param>
public InstallUrlMiddleware(RequestDelegate next)
{
_next = next;
Expand Down Expand Up @@ -54,7 +50,7 @@ public async Task Invoke(HttpContext context, IWebHelper webHelper)
//or call the next middleware in the request pipeline
await _next(context);
}

#endregion
}
}
}
Loading

0 comments on commit 87bdef7

Please sign in to comment.