forked from couchbaselabs/couchbase-aspnet
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Got rid of disposing of Couchbase buckets since that is not desired i…
…n 2.1, changed references from 'client' to 'bucket', added clear documentation to the session state store based on our private SqlSessionStateStore code and cleaned up code formatting using Resharper and a solution specific settings file.
- Loading branch information
Showing
9 changed files
with
696 additions
and
276 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 50 additions & 44 deletions
94
Couchbase.AspNet/CouchbaseClientFactory.cs → Couchbase.AspNet/CouchbaseBucketFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,51 @@ | ||
using System.Collections.Specialized; | ||
using Couchbase.Core; | ||
|
||
namespace Couchbase.AspNet | ||
{ | ||
public sealed class CouchbaseClientFactory : ICouchbaseClientFactory | ||
{ | ||
public IBucket Create(string name, NameValueCollection config, out bool disposeClient) | ||
{ | ||
// This client should be disposed of as it is not shared | ||
disposeClient = true; | ||
|
||
// Get the bucket name to use from the configuration file and use a specific bucket if specified | ||
var bucketName = ProviderHelper.GetAndRemove(config, "bucket", false); | ||
if (!string.IsNullOrEmpty(bucketName)) | ||
return ClusterHelper.GetBucket(bucketName); | ||
|
||
// If no bucket is specified, simply use the default bucket (which will be the first in the list) | ||
return ClusterHelper.Get().OpenBucket(); | ||
} | ||
} | ||
} | ||
|
||
#region [ License information ] | ||
/* ************************************************************ | ||
* | ||
* @author Couchbase <[email protected]> | ||
* @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. | ||
* | ||
* ************************************************************/ | ||
using System.Collections.Specialized; | ||
using Couchbase.Core; | ||
|
||
namespace Couchbase.AspNet | ||
{ | ||
public sealed class CouchbaseBucketFactory : ICouchbaseBucketFactory | ||
{ | ||
/// <summary> | ||
/// Returns a Couchbase bucket or create one if it does not exist | ||
/// </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 bucket to use</returns> | ||
public IBucket GetBucket( | ||
string name, | ||
NameValueCollection config) | ||
{ | ||
// Get the bucket name to use from the configuration file and use a specific bucket if specified | ||
var bucketName = ProviderHelper.GetAndRemove(config, "bucket", false); | ||
if (!string.IsNullOrEmpty(bucketName)) | ||
return ClusterHelper.GetBucket(bucketName); | ||
|
||
// If no bucket is specified, simply use the default bucket (which will be the first in the list) | ||
return ClusterHelper.Get().OpenBucket(); | ||
} | ||
} | ||
} | ||
|
||
#region [ License information ] | ||
/* ************************************************************ | ||
* | ||
* @author Couchbase <[email protected]> | ||
* @copyright 2012 Couchbase, Inc. | ||
* @copyright 2012 Attila Kiskó, enyim.com | ||
* @copyright 2012 Good Time Hobbies, Inc. | ||
* @copyright 2015 AMain.com, 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 |
84 changes: 42 additions & 42 deletions
84
Couchbase.AspNet/ICouchbaseClientFactory.cs → Couchbase.AspNet/ICouchbaseBucketFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
using System.Collections.Specialized; | ||
using Couchbase.Core; | ||
|
||
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> | ||
/// <param name="disposeClient">True if the client should be disposed of or not</param> | ||
/// <returns>Instance of the couchbase client to use</returns> | ||
IBucket Create(string name, NameValueCollection config, out bool disposeClient); | ||
} | ||
} | ||
|
||
#region [ License information ] | ||
/* ************************************************************ | ||
* | ||
* @author Couchbase <[email protected]> | ||
* @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 | ||
using System.Collections.Specialized; | ||
using Couchbase.Core; | ||
|
||
namespace Couchbase.AspNet | ||
{ | ||
public interface ICouchbaseBucketFactory | ||
{ | ||
/// <summary> | ||
/// Returns a Couchbase bucket or create one if it does not exist | ||
/// </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 bucket to use</returns> | ||
IBucket GetBucket( | ||
string name, | ||
NameValueCollection config); | ||
} | ||
} | ||
|
||
#region [ License information ] | ||
/* ************************************************************ | ||
* | ||
* @author Couchbase <[email protected]> | ||
* @copyright 2012 Couchbase, Inc. | ||
* @copyright 2012 Attila Kiskó, enyim.com | ||
* @copyright 2012 Good Time Hobbies, Inc. | ||
* @copyright 2015 AMain.com, 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.