Skip to content

Commit

Permalink
Move MongoDB specific settings to MongoDB project
Browse files Browse the repository at this point in the history
Created MongoMiniProfiler.Settings for settings specific to the MongDB
project, fixed spelling in Obsolete attributes.
  • Loading branch information
kalahari committed Aug 29, 2014
1 parent d48e29a commit 79961ce
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
24 changes: 24 additions & 0 deletions StackExchange.Profiling.MongoDB/MongoMiniProfiler.Settings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.ComponentModel;

namespace StackExchange.Profiling.MongoDB
{
public partial class MongoMiniProfiler
{
/// <summary>
/// Various configuration properties.
/// </summary>
public static class Settings
{
static Settings()
{
MaxServerCount = 100;
}

/// <summary>
/// Maximum number of ProfiledeMongoServer instance to create, defaults to 100.
/// </summary>
[DefaultValue(100)]
public static int MaxServerCount { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion StackExchange.Profiling.MongoDB/MongoMiniProfiler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace StackExchange.Profiling.MongoDB
{
public class MongoMiniProfiler
public partial class MongoMiniProfiler
{
public const string CategoryName = "mongo";
}
Expand Down
6 changes: 3 additions & 3 deletions StackExchange.Profiling.MongoDB/ProfiledMongoServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ public class ProfiledMongoServer : MongoServer
{
private readonly static object __staticLock = new object();
private readonly static Dictionary<MongoServerSettings, ProfiledMongoServer> __servers = new Dictionary<MongoServerSettings, ProfiledMongoServer>();
private static int __maxServerCount = MiniProfiler.Settings.MaxMongoServerCount;
private static int __maxServerCount = MongoMiniProfiler.Settings.MaxServerCount;

[Obsolete("This may leak server connectinos, use ProfiledMongoServer.Create instead.")]
[Obsolete("This may leak server connections, use ProfiledMongoServer.Create instead.")]
public ProfiledMongoServer(MongoServerSettings settings) : base(settings)
{
}

[Obsolete("This may leak server connectinos, use ProfiledMongoServer.Create instead.")]
[Obsolete("This may leak server connections, use ProfiledMongoServer.Create instead.")]
public ProfiledMongoServer(MongoServer server) : base (server.Settings)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="MongoMiniProfiler.cs" />
<Compile Include="MongoMiniProfiler.Settings.cs">
<DependentUpon>MongoMiniProfiler.cs</DependentUpon>
</Compile>
<Compile Include="ProfiledEnumerator.cs" />
<Compile Include="ProfiledMongoCollection.cs" />
<Compile Include="ProfiledMongoCursor.cs" />
Expand Down
6 changes: 0 additions & 6 deletions StackExchange.Profiling/MiniProfiler.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,6 @@ public static void ExcludeMethod(string methodName)
[DefaultValue(2097152)]
public static int MaxJsonResponseSize { get; set; }

/// <summary>
/// Maximum number of ProfiledeMongoServer instance to create, defaults to 100.
/// </summary>
[DefaultValue(100)]
public static int MaxMongoServerCount { get; set; }

/// <summary>
/// Understands how to save and load MiniProfilers. Used for caching between when
/// a profiling session ends and results can be fetched to the client, and for showing shared, full-page results.
Expand Down

0 comments on commit 79961ce

Please sign in to comment.