You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2016/10/03 09:55:44 UTC
[13/30] ignite git commit: IGNITE-3995 .NET: Introduced default
non-null ASP.NET Session-State Store Provider cache name. This closes #1128.
IGNITE-3995 .NET: Introduced default non-null ASP.NET Session-State Store Provider cache name. This closes #1128.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/53229e29
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/53229e29
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/53229e29
Branch: refs/heads/master
Commit: 53229e290f7d6aab9b504693bd2b93155ecd2bad
Parents: bfe4458
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Sep 28 17:07:47 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 28 17:07:47 2016 +0300
----------------------------------------------------------------------
.../IgniteSessionStateStoreProviderTest.cs | 13 +++++++++++++
.../Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs | 2 +-
.../IgniteSessionStateStoreProvider.cs | 8 +++++++-
.../dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs | 13 +++++++------
4 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/53229e29/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
index fc239ad..2c73359 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs
@@ -133,6 +133,19 @@ namespace Apache.Ignite.AspNet.Tests
stateProvider = GetProvider();
CheckProvider(stateProvider);
+
+ // Omitted cache name results in default cache name (not null).
+ stateProvider = new IgniteSessionStateStoreProvider();
+
+ stateProvider.Initialize("testName", new NameValueCollection
+ {
+ {GridNameAttr, GridName}
+ });
+
+ var cacheNames = Ignition.GetIgnite(GridName).GetCacheNames();
+
+ Assert.IsFalse(cacheNames.Contains(null));
+ Assert.IsTrue(cacheNames.Contains(IgniteSessionStateStoreProvider.DefaultCacheName));
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/53229e29/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs
index d232726..2790493 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteOutputCacheProvider.cs
@@ -99,7 +99,7 @@ namespace Apache.Ignite.AspNet
{
base.Initialize(name, config);
- var cache = ConfigUtil.InitializeCache<string, object>(config, GetType());
+ var cache = ConfigUtil.InitializeCache<string, object>(config, GetType(), null);
_expiryCacheHolder = new ExpiryCacheHolder<string, object>(cache);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/53229e29/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
index 1ee6d92..86035dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
@@ -47,6 +47,11 @@ namespace Apache.Ignite.AspNet
/// </summary>
public class IgniteSessionStateStoreProvider : SessionStateStoreProviderBase
{
+ /// <summary>
+ /// The default cache name to be used when <c>cacheName</c> attribute is not specified.
+ /// </summary>
+ public const string DefaultCacheName = "ASPNET_SESSION_STATE";
+
/** Extension id */
private const int ExtensionId = 0;
@@ -94,7 +99,8 @@ namespace Apache.Ignite.AspNet
{
base.Initialize(name, config);
- var cache = ConfigUtil.InitializeCache<string, IgniteSessionStateStoreData>(config, GetType());
+ var cache = ConfigUtil.InitializeCache<string, IgniteSessionStateStoreData>(config, GetType(),
+ DefaultCacheName);
_expiryCacheHolder = new ExpiryCacheHolder<string, IgniteSessionStateStoreData>(cache);
http://git-wip-us.apache.org/repos/asf/ignite/blob/53229e29/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
index 3eb3d90..a162d81 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.AspNet.Impl
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
+ using System.Linq;
using Apache.Ignite.Core;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Configuration;
@@ -33,24 +34,25 @@ namespace Apache.Ignite.AspNet.Impl
internal static class ConfigUtil
{
/** */
- public const string GridName = "gridName";
+ private const string GridName = "gridName";
/** */
- public const string CacheName = "cacheName";
+ private const string CacheName = "cacheName";
/** */
- public const string IgniteConfigurationSectionName = "igniteConfigurationSectionName";
+ private const string IgniteConfigurationSectionName = "igniteConfigurationSectionName";
/// <summary>
/// Initializes the cache from configuration.
/// </summary>
- public static ICache<TK, TV> InitializeCache<TK, TV>(NameValueCollection config, Type callerType)
+ public static ICache<TK, TV> InitializeCache<TK, TV>(NameValueCollection config, Type callerType,
+ string defaultCacheName)
{
Debug.Assert(config != null);
Debug.Assert(callerType != null);
var gridName = config[GridName];
- var cacheName = config[CacheName];
+ var cacheName = config.AllKeys.Contains(CacheName) ? config[CacheName] : defaultCacheName;
var cfgSection = config[IgniteConfigurationSectionName];
try
@@ -66,7 +68,6 @@ namespace Apache.Ignite.AspNet.Impl
throw new IgniteException(string.Format(CultureInfo.InvariantCulture,
"Failed to initialize {0}: {1}", callerType, ex), ex);
}
-
}
/// <summary>