Skip to content

Commit

Permalink
Initial port of Enyim MemcachedClient SessionState provider to Couchb…
Browse files Browse the repository at this point in the history
…aseClient

Nuget reference to CouchbaseClient 1.0.1 included.
  • Loading branch information
jzablocki committed Apr 24, 2012
1 parent 0983dd3 commit cf44ef8
Show file tree
Hide file tree
Showing 17 changed files with 2,822 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .gitignore
@@ -1,6 +1,5 @@
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) **/bin/*
bin **/obj/*
obj TestResults/*

*.suo
# mstest test results *.user
TestResults
31 changes: 31 additions & 0 deletions Couchbase.AspNet.sln
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Couchbase.AspNet", "Couchbase.AspNet\Couchbase.AspNet.csproj", "{A53FF68E-9029-4652-A59D-F9FFD097C206}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CouchbaseAspNetSample", "CouchbaseAspNetSample\CouchbaseAspNetSample.csproj", "{E0E0512D-42ED-4302-9E1D-182FE3945F28}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CC6DB7EC-7DAD-4B28-82DC-560C304AA915}"
ProjectSection(SolutionItems) = preProject
Readme.mdown = Readme.mdown
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A53FF68E-9029-4652-A59D-F9FFD097C206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A53FF68E-9029-4652-A59D-F9FFD097C206}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A53FF68E-9029-4652-A59D-F9FFD097C206}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A53FF68E-9029-4652-A59D-F9FFD097C206}.Release|Any CPU.Build.0 = Release|Any CPU
{E0E0512D-42ED-4302-9E1D-182FE3945F28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E0E0512D-42ED-4302-9E1D-182FE3945F28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0E0512D-42ED-4302-9E1D-182FE3945F28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0E0512D-42ED-4302-9E1D-182FE3945F28}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
71 changes: 71 additions & 0 deletions Couchbase.AspNet/Couchbase.AspNet.csproj
@@ -0,0 +1,71 @@
<?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.0.1\lib\net35\Couchbase.dll</HintPath>
</Reference>
<Reference Include="Enyim.Caching">
<HintPath>..\packages\CouchbaseNetClient.1.0.1\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="Properties\AssemblyInfo.cs" />
<Compile Include="SessionState\CouchbaseClientFactory.cs" />
<Compile Include="SessionState\CouchbaseSessionStateProvider.cs" />
<Compile Include="SessionState\ICouchbaseClient.cs" />
<Compile Include="SessionState\ICouchbaseClientFactory.cs" />
<Compile Include="SessionState\ProviderHelper.cs" />
<Compile Include="Web\CouchbaseHttpApplication.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<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>
36 changes: 36 additions & 0 deletions Couchbase.AspNet/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CouchbaseAspNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CouchbaseAspNet")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4202b9fa-28b5-4a1f-a7d2-bf51311d9471")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
45 changes: 45 additions & 0 deletions Couchbase.AspNet/SessionState/CouchbaseClientFactory.cs
@@ -0,0 +1,45 @@
using System;
using System.Collections.Specialized;
using System.Configuration;
using Enyim.Caching;
using Couchbase.Configuration;

namespace Couchbase.AspNet.SessionState
{
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

0 comments on commit cf44ef8

Please sign in to comment.