Skip to content

Commit

Permalink
Updated to working version of Session State and Output Cache
Browse files Browse the repository at this point in the history
Session State provider has been improved to fix bug, as well as add
support for disabling session locking when desired. Output Cache is
updated to use our version of the provider which is fully tested and
running in production.
  • Loading branch information
Kendall Bennett committed Sep 9, 2012
1 parent cf8a591 commit 0c917bd
Show file tree
Hide file tree
Showing 12 changed files with 1,164 additions and 1,045 deletions.
147 changes: 78 additions & 69 deletions Couchbase.AspNet/Couchbase.AspNet.csproj
Original file line number Diff line number Diff line change
@@ -1,70 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A53FF68E-9029-4652-A59D-F9FFD097C206}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Couchbase.AspNet</RootNamespace>
<AssemblyName>Couchbase.AspNet</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Couchbase">
<HintPath>..\packages\CouchbaseNetClient.1.1.6\lib\net35\Couchbase.dll</HintPath>
</Reference>
<Reference Include="Enyim.Caching">
<HintPath>..\packages\CouchbaseNetClient.1.1.6\lib\net35\Enyim.Caching.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="OutputCache\CouchbaseOutputCacheProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CouchbaseClientFactory.cs" />
<Compile Include="SessionState\CouchbaseSessionStateProvider.cs" />
<Compile Include="ICouchbaseClientFactory.cs" />
<Compile Include="ProviderHelper.cs" />
<Compile Include="Web\CouchbaseHttpApplication.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A53FF68E-9029-4652-A59D-F9FFD097C206}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Couchbase.AspNet</RootNamespace>
<AssemblyName>Couchbase.AspNet</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Couchbase.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Couchbase, Version=1.1.4635.18746, Culture=neutral, PublicKeyToken=269b55efb37646d0, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CouchbaseNetClient.1.1.6\lib\net35\Couchbase.dll</HintPath>
</Reference>
<Reference Include="Enyim.Caching, Version=1.0.0.0, Culture=neutral, PublicKeyToken=269b55efb37646d0, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\CouchbaseNetClient.1.1.6\lib\net35\Enyim.Caching.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="OutputCache\CouchbaseOutputCacheProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CouchbaseClientFactory.cs" />
<Compile Include="SessionState\CouchbaseSessionStateProvider.cs" />
<Compile Include="ICouchbaseClientFactory.cs" />
<Compile Include="ProviderHelper.cs" />
<Compile Include="Web\CouchbaseHttpApplication.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Couchbase.snk" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Binary file added Couchbase.AspNet/Couchbase.snk
Binary file not shown.
94 changes: 49 additions & 45 deletions Couchbase.AspNet/CouchbaseClientFactory.cs
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
using System;
using System.Collections.Specialized;
using System.Configuration;
using Enyim.Caching;
using Couchbase.Configuration;

namespace Couchbase.AspNet
{
public sealed class CouchbaseClientFactory : ICouchbaseClientFactory
{
public IMemcachedClient Create(string name, NameValueCollection config)
{
var sectionName = ProviderHelper.GetAndRemove(config, "section", false);
if (String.IsNullOrEmpty(sectionName))
return new CouchbaseClient();

var section = ConfigurationManager.GetSection(sectionName) as ICouchbaseClientConfiguration;
if (section == null) throw new InvalidOperationException("Invalid config section: " + section);

return new CouchbaseClient(section);
}
}
}

#region [ License information ]
/* ************************************************************
*
* @author Couchbase <info@couchbase.com>
* @copyright 2012 Couchbase, Inc.
* @copyright 2012 Attila Kiskó, enyim.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ************************************************************/
#endregion
using System;
using System.Collections.Specialized;
using System.Configuration;
using Enyim.Caching;
using Couchbase.Configuration;

namespace Couchbase.AspNet
{
public sealed class CouchbaseClientFactory : ICouchbaseClientFactory
{
public IMemcachedClient Create(string name, NameValueCollection config)
{
// Get the section name from the configuration file. If not found, create a default Couchbase client which
// will get the configuration information from the default Couchbase client section in the Web.config file
var sectionName = ProviderHelper.GetAndRemove(config, "section", false);
if (String.IsNullOrEmpty(sectionName))
return new CouchbaseClient();

// If a custom section name is passed in, get the section information and use it to construct the Couchbase client
var section = ConfigurationManager.GetSection(sectionName) as ICouchbaseClientConfiguration;
if (section == null)
throw new InvalidOperationException("Invalid config section: " + section);
return new CouchbaseClient(section);
}
}
}

#region [ License information ]
/* ************************************************************
*
* @author Couchbase <info@couchbase.com>
* @copyright 2012 Couchbase, Inc.
* @copyright 2012 Attila Kiskó, enyim.com
* @copyright 2012 Good Time Hobbies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ************************************************************/
#endregion
80 changes: 41 additions & 39 deletions Couchbase.AspNet/ICouchbaseClientFactory.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
using System;
using System.Collections.Specialized;
using Enyim.Caching;

namespace Couchbase.AspNet
{
public interface ICouchbaseClientFactory
{
/// <summary>
/// Returns a memcached client. This will be called by the provider's Initialize method.
/// </summary>
/// <param name="name"></param>
/// <param name="config"></param>
/// <returns></returns>
IMemcachedClient Create(string name, NameValueCollection config);
}
}

#region [ License information ]
/* ************************************************************
*
* @author Couchbase <info@couchbase.com>
* @copyright 2012 Couchbase, Inc.
* @copyright 2012 Attila Kiskó, enyim.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ************************************************************/
#endregion
using System.Collections.Specialized;
using Enyim.Caching;

namespace Couchbase.AspNet
{
public interface ICouchbaseClientFactory
{
/// <summary>
/// Returns a Couchbase client. This will be called by the provider's Initialize method. Note
/// that the instance of the client returned will be owned by the called, and will be disposed.
/// So make sure you don't return a shared instance, but create a new one.
/// </summary>
/// <param name="name">Name of the section from the configuration file</param>
/// <param name="config">Configuration section information from the config file</param>
/// <returns>Instance of the couchbase client to use</returns>
IMemcachedClient Create(string name, NameValueCollection config);
}
}

#region [ License information ]
/* ************************************************************
*
* @author Couchbase <info@couchbase.com>
* @copyright 2012 Couchbase, Inc.
* @copyright 2012 Attila Kiskó, enyim.com
* @copyright 2012 Good Time Hobbies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ************************************************************/
#endregion
Loading

0 comments on commit 0c917bd

Please sign in to comment.