mirror of
https://github.com/ldqk/Masuit.Tools.git
synced 2026-10-29 04:37:01 +08:00
Merge branch 'master' of https://github.com/ldqk/Masuit.Tools
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Masuit.Tools.NoSQL.MongoDBClient.UnitTest\Masuit.Tools.NoSQL.MongoDBClient.UnitTest.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,34 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Version>1.8.6</Version>
|
||||
<Authors>懒得勤快</Authors>
|
||||
<Company>masuit.com</Company>
|
||||
<Description>包含MongoDB的所有的增删查改。
|
||||
客户端类采用单例模式进行封装,所以只需要调用MongoDbClient.GetInstance()即可使用。</Description>
|
||||
<Copyright>Copyright © 懒得勤快</Copyright>
|
||||
<PackageLicenseUrl></PackageLicenseUrl>
|
||||
<PackageProjectUrl>https://github.com/ldqk/Masuit.Tools</PackageProjectUrl>
|
||||
<PackageTags>Masuit.Tools</PackageTags>
|
||||
<PackageReleaseNotes>如有问题请联系QQ:3444764617,或者到项目的github反馈问题。</PackageReleaseNotes>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<AssemblyVersion>1.8.6.0</AssemblyVersion>
|
||||
<FileVersion>1.8.6.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<CodeAnalysisRuleSet />
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<CodeAnalysisRuleSet />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Bson" Version="2.7.3" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.7.3" />
|
||||
<PackageReference Include="MongoDB.Driver.Core" Version="2.7.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
-74
@@ -1,74 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{6CA28B75-2F2D-401A-BDF7-EE314C14C95F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Masuit.Tools.NoSQL.MongoDBClient.UnitTest</RootNamespace>
|
||||
<AssemblyName>Masuit.Tools.NoSQL.MongoDBClient.UnitTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</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="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Masuit.Tools.NoSQL.MongoDBClient\Masuit.Tools.NoSQL.MongoDBClient.csproj">
|
||||
<Project>{1d45bdc4-74c4-4356-8b93-7f7a09106bb8}</Project>
|
||||
<Name>Masuit.Tools.NoSQL.MongoDBClient</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("Masuit.Tools.NoSQL.MongoDBClient.UnitTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Masuit.Tools.NoSQL.MongoDBClient.UnitTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("6ca28b75-2f2d-401a-bdf7-ee314c14c95f")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="DnsClient" publicKeyToken="4574bb5573c51424" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="1.4.0" targetFramework="net461" />
|
||||
<package id="MSTest.TestFramework" version="1.4.0" targetFramework="net461" />
|
||||
</packages>
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
|
||||
namespace Masuit.Tools.NoSQL.MongoDBClient.Core
|
||||
namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
{
|
||||
/// <summary>
|
||||
/// 取线程内唯一对象
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Masuit.Tools.NoSQL.MongoDBClient.Core
|
||||
namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
{
|
||||
/// <summary>
|
||||
/// 定长队列
|
||||
@@ -1,81 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1D45BDC4-74C4-4356-8B93-7F7A09106BB8}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Masuit.Tools.NoSQL.MongoDBClient</RootNamespace>
|
||||
<AssemblyName>Masuit.Tools.NoSQL.MongoDBClient</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Version>1.8.6</Version>
|
||||
<Authors>懒得勤快</Authors>
|
||||
<Company>masuit.com</Company>
|
||||
<Description>包含MongoDB的所有的增删查改。
|
||||
客户端类采用单例模式进行封装,所以只需要调用MongoDbClient.GetInstance()即可使用。</Description>
|
||||
<Copyright>Copyright © 懒得勤快</Copyright>
|
||||
<PackageLicenseUrl></PackageLicenseUrl>
|
||||
<PackageProjectUrl>https://github.com/ldqk/Masuit.Tools</PackageProjectUrl>
|
||||
<PackageTags>Masuit.Tools</PackageTags>
|
||||
<PackageReleaseNotes>如有问题请联系QQ:3444764617,或者到项目的github反馈问题。</PackageReleaseNotes>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<AssemblyVersion>1.8.6.0</AssemblyVersion>
|
||||
<FileVersion>1.8.6.0</FileVersion>
|
||||
</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 Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<CodeAnalysisRuleSet />
|
||||
</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>
|
||||
<DocumentationFile>bin\Release\Masuit.Tools.NoSQL.MongoDBClient.xml</DocumentationFile>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<CodeAnalysisRuleSet />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="DnsClient, Version=1.2.0.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DnsClient.1.2.0\lib\net45\DnsClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HtmlSanitizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=61c49a1a9e79cc28, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\HtmlSanitizer.4.0.207\lib\net45\HtmlSanitizer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="MongoDB.Bson, Version=2.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Bson.2.7.3\lib\net45\MongoDB.Bson.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Driver, Version=2.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Driver.2.7.3\lib\net45\MongoDB.Driver.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Driver.Core, Version=2.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Driver.Core.2.7.3\lib\net45\MongoDB.Driver.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="StackExchange.Redis, Version=1.2.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\StackExchange.Redis.1.2.6\lib\net45\StackExchange.Redis.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||
</Reference>
|
||||
<PackageReference Include="MongoDB.Bson" Version="2.8.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.8.0" />
|
||||
<PackageReference Include="MongoDB.Driver.Core" Version="2.8.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MongoDbClient.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Masuit.Tools\Masuit.Tools.csproj">
|
||||
<Project>{275D5A0D-C49C-497E-A4B5-F40285C2495F}</Project>
|
||||
<Name>Masuit.Tools</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,32 +1,21 @@
|
||||
using Masuit.Tools.Systems;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
{
|
||||
/// <summary>
|
||||
/// MongoDB客户端类
|
||||
/// </summary>
|
||||
public class MongoDbClient
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户端对象
|
||||
/// </summary>
|
||||
public MongoClient Client { get; set; }
|
||||
/// <summary>
|
||||
/// 数据库对象
|
||||
/// </summary>
|
||||
public IMongoDatabase Database { get; set; }
|
||||
private static ConcurrentDictionary<string, MongoDbClient> InstancePool { get; set; } = new ConcurrentDictionary<string, MongoDbClient>();
|
||||
private static ConcurrentDictionary<string, ConcurrentLimitedQueue<MongoDbClient>> InstanceQueue { get; set; } = new ConcurrentDictionary<string, ConcurrentLimitedQueue<MongoDbClient>>();
|
||||
|
||||
private MongoDbClient(string url, string database)
|
||||
{
|
||||
Client = new MongoClient(url);
|
||||
@@ -53,23 +42,7 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
instance = new MongoDbClient(url, database);
|
||||
InstancePool.TryAdd(url + database, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取mongo默认单例
|
||||
/// </summary>
|
||||
/// <param name="database">数据库</param>
|
||||
/// <returns></returns>
|
||||
public static MongoDbClient GetDefaultInstance(string database)
|
||||
{
|
||||
string cs = ConfigurationManager.ConnectionStrings["MongoDB"].ConnectionString ?? "mongodb://127.0.0.1:27017";
|
||||
InstancePool.TryGetValue(cs + database, out var instance);
|
||||
if (instance is null)
|
||||
{
|
||||
instance = new MongoDbClient(cs, database);
|
||||
InstancePool.TryAdd(cs + database, instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -89,13 +62,15 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
queue.Enqueue(new MongoDbClient(url, database));
|
||||
});
|
||||
}
|
||||
|
||||
MongoDbClient instance;
|
||||
if (CallContext.GetData(url + database) == null)
|
||||
if (CallContext<MongoDbClient>.GetData(url + database) == null)
|
||||
{
|
||||
queue.TryDequeue(out instance);
|
||||
CallContext.SetData(url + database, instance);
|
||||
CallContext<MongoDbClient>.SetData(url + database, instance);
|
||||
}
|
||||
instance = (MongoDbClient)CallContext.GetData(url + database);
|
||||
|
||||
instance = CallContext<MongoDbClient>.GetData(url + database);
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -261,7 +236,10 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
/// <returns></returns>
|
||||
public string UpdateOne<T>(string collection, Expression<Func<T, Boolean>> filter, UpdateDefinition<T> update, bool upsert)
|
||||
{
|
||||
UpdateResult result = Database.GetCollection<T>(collection).UpdateOne(filter, update, new UpdateOptions() { IsUpsert = upsert });
|
||||
UpdateResult result = Database.GetCollection<T>(collection).UpdateOne(filter, update, new UpdateOptions()
|
||||
{
|
||||
IsUpsert = upsert
|
||||
});
|
||||
return result.ToJson();
|
||||
}
|
||||
|
||||
@@ -275,7 +253,10 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
/// <returns></returns>
|
||||
public string UpdateOne(string collection, Expression<Func<BsonDocument, Boolean>> filter, UpdateDefinition<BsonDocument> update, bool upsert)
|
||||
{
|
||||
UpdateResult result = Database.GetCollection<BsonDocument>(collection).UpdateOne(filter, update, new UpdateOptions() { IsUpsert = upsert });
|
||||
UpdateResult result = Database.GetCollection<BsonDocument>(collection).UpdateOne(filter, update, new UpdateOptions()
|
||||
{
|
||||
IsUpsert = upsert
|
||||
});
|
||||
return result.ToJson();
|
||||
}
|
||||
|
||||
@@ -290,7 +271,10 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
/// <returns></returns>
|
||||
public async Task<string> UpdateOneAsync<T>(string collection, Expression<Func<T, Boolean>> filter, UpdateDefinition<T> update, bool upsert)
|
||||
{
|
||||
UpdateResult result = await Database.GetCollection<T>(collection).UpdateOneAsync(filter, update, new UpdateOptions() { IsUpsert = upsert });
|
||||
UpdateResult result = await Database.GetCollection<T>(collection).UpdateOneAsync(filter, update, new UpdateOptions()
|
||||
{
|
||||
IsUpsert = upsert
|
||||
});
|
||||
return result.ToJson();
|
||||
}
|
||||
|
||||
@@ -304,7 +288,10 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
/// <returns></returns>
|
||||
public async Task<string> UpdateOneAsync(string collection, Expression<Func<BsonDocument, Boolean>> filter, UpdateDefinition<BsonDocument> update, bool upsert)
|
||||
{
|
||||
UpdateResult result = await Database.GetCollection<BsonDocument>(collection).UpdateOneAsync(filter, update, new UpdateOptions() { IsUpsert = upsert });
|
||||
UpdateResult result = await Database.GetCollection<BsonDocument>(collection).UpdateOneAsync(filter, update, new UpdateOptions()
|
||||
{
|
||||
IsUpsert = upsert
|
||||
});
|
||||
return result.ToJson();
|
||||
}
|
||||
|
||||
@@ -318,7 +305,10 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
/// <returns></returns>
|
||||
public Int64 UpdateMany<T>(String collName, Expression<Func<T, Boolean>> filter, UpdateDefinition<T> update, Boolean upsert = false)
|
||||
{
|
||||
UpdateResult result = Database.GetCollection<T>(collName).UpdateMany(filter, update, new UpdateOptions { IsUpsert = upsert });
|
||||
UpdateResult result = Database.GetCollection<T>(collName).UpdateMany(filter, update, new UpdateOptions
|
||||
{
|
||||
IsUpsert = upsert
|
||||
});
|
||||
return result.ModifiedCount;
|
||||
}
|
||||
|
||||
@@ -332,7 +322,10 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
/// <returns></returns>
|
||||
public Int64 UpdateMany(String collName, Expression<Func<BsonDocument, Boolean>> filter, UpdateDefinition<BsonDocument> update, Boolean upsert = false)
|
||||
{
|
||||
UpdateResult result = Database.GetCollection<BsonDocument>(collName).UpdateMany(filter, update, new UpdateOptions { IsUpsert = upsert });
|
||||
UpdateResult result = Database.GetCollection<BsonDocument>(collName).UpdateMany(filter, update, new UpdateOptions
|
||||
{
|
||||
IsUpsert = upsert
|
||||
});
|
||||
return result.ModifiedCount;
|
||||
}
|
||||
|
||||
@@ -347,7 +340,10 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
/// <returns></returns>
|
||||
public async Task<long> UpdateManyAsync<T>(String collName, Expression<Func<T, Boolean>> filter, UpdateDefinition<T> update, Boolean upsert = false)
|
||||
{
|
||||
UpdateResult result = await Database.GetCollection<T>(collName).UpdateManyAsync(filter, update, new UpdateOptions { IsUpsert = upsert });
|
||||
UpdateResult result = await Database.GetCollection<T>(collName).UpdateManyAsync(filter, update, new UpdateOptions
|
||||
{
|
||||
IsUpsert = upsert
|
||||
});
|
||||
return result.ModifiedCount;
|
||||
}
|
||||
|
||||
@@ -361,7 +357,10 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
/// <returns></returns>
|
||||
public async Task<long> UpdateManyAsync(String collName, Expression<Func<BsonDocument, Boolean>> filter, UpdateDefinition<BsonDocument> update, Boolean upsert = false)
|
||||
{
|
||||
UpdateResult result = await Database.GetCollection<BsonDocument>(collName).UpdateManyAsync(filter, update, new UpdateOptions { IsUpsert = upsert });
|
||||
UpdateResult result = await Database.GetCollection<BsonDocument>(collName).UpdateManyAsync(filter, update, new UpdateOptions
|
||||
{
|
||||
IsUpsert = upsert
|
||||
});
|
||||
return result.ModifiedCount;
|
||||
}
|
||||
|
||||
@@ -1060,6 +1059,7 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
return mgr.CreateOne(new CreateIndexModel<BsonDocument>(asc ? Builders<BsonDocument>.IndexKeys.Ascending(doc => doc[index]) : Builders<BsonDocument>.IndexKeys.Descending(doc => doc[index])));
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
@@ -1081,6 +1081,7 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
return await mgr.CreateOneAsync(new CreateIndexModel<BsonDocument>(asc ? Builders<BsonDocument>.IndexKeys.Ascending(doc => doc[index]) : Builders<BsonDocument>.IndexKeys.Descending(doc => doc[index])));
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
@@ -1151,6 +1152,7 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
return mgr.CreateOne(new CreateIndexModel<T>(asc ? Builders<T>.IndexKeys.Ascending(key) : Builders<T>.IndexKeys.Descending(key)));
|
||||
}
|
||||
}
|
||||
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
@@ -1173,6 +1175,7 @@ namespace Masuit.Tools.NoSQL.MongoDBClient
|
||||
return await mgr.CreateOneAsync(new CreateIndexModel<T>(asc ? Builders<T>.IndexKeys.Ascending(key) : Builders<T>.IndexKeys.Descending(key)));
|
||||
}
|
||||
}
|
||||
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Masuit.Tools.NoSQL.MongoDBClient")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("masuit.com")]
|
||||
[assembly: AssemblyProduct("Masuit.Tools.NoSQL.MongoDBClient")]
|
||||
[assembly: AssemblyCopyright("Copyright © 懒得勤快")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("1d45bdc4-74c4-4356-8b93-7f7a09106bb8")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.8.6.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.6.0")]
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="DnsClient" publicKeyToken="4574bb5573c51424" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AngleSharp" version="0.9.11" targetFramework="net45" />
|
||||
<package id="DnsClient" version="1.2.0" targetFramework="net45" />
|
||||
<package id="HtmlSanitizer" version="4.0.207" targetFramework="net45" />
|
||||
<package id="MongoDB.Bson" version="2.7.3" targetFramework="net45" />
|
||||
<package id="MongoDB.Driver" version="2.7.3" targetFramework="net45" />
|
||||
<package id="MongoDB.Driver.Core" version="2.7.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net45" />
|
||||
<package id="SharpZipLib" version="1.1.0" targetFramework="net45" />
|
||||
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net45" />
|
||||
<package id="System.Buffers" version="4.4.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net45" />
|
||||
</packages>
|
||||
+6
-26
@@ -5,22 +5,14 @@ VisualStudioVersion = 15.0.27130.2036
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masuit.Tools", "Masuit.Tools\Masuit.Tools.csproj", "{275D5A0D-C49C-497E-A4B5-F40285C2495F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masuit.Tools.NoSQL.MongoDBClient", "Masuit.Tools.NoSQL.MongoDBClient\Masuit.Tools.NoSQL.MongoDBClient.csproj", "{1D45BDC4-74C4-4356-8B93-7F7A09106BB8}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.Tools.Core", "Masuit.Tools.Core\Masuit.Tools.Core.csproj", "{149E6872-CE95-493B-B136-535E64C65A49}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.Tools.NoSQL.MongoDBClient.Core", "Masuit.Tools.NoSQL.MongoDBClient.Core\Masuit.Tools.NoSQL.MongoDBClient.Core.csproj", "{85EEA76D-CDAB-44CB-A08C-A49FDBA4659D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masuit.Tools.UnitTest", "Masuit.Tools.UnitTest\Masuit.Tools.UnitTest.csproj", "{174474CB-0C9A-4C99-B461-1A2158F00A98}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.Tools.Core.UnitTest", "Masuit.Tools.Core.UnitTest\Masuit.Tools.Core.UnitTest.csproj", "{82383331-259E-4FB8-BA90-47C0E1AFB4FA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masuit.Tools.NoSQL.MongoDBClient.UnitTest", "Masuit.Tools.NoSQL.MongoDBClient.UnitTest\Masuit.Tools.NoSQL.MongoDBClient.UnitTest.csproj", "{6CA28B75-2F2D-401A-BDF7-EE314C14C95F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "测试", "测试", "{E0B8FBD1-A28A-4420-9DE2-6BD06035CBAC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.Tools.NoSQL.MongoDBClient.Core.UnitTest", "Masuit.Tools.NoSQL.MongoDBClient.Core.UnitTest\Masuit.Tools.NoSQL.MongoDBClient.Core.UnitTest.csproj", "{9D2E3A00-9E94-4C3D-AAAE-70B0DA236FE6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{91954D82-A5FC-417B-8FD9-D9C165C8F16C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetCoreTest", "NetCoreTest\NetCoreTest.csproj", "{ABEC3F65-6556-44FD-BECE-33F7927FB3AE}"
|
||||
@@ -29,6 +21,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.Tools.AspNetCore.Res
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.Tools.ExpressionMapperBenchmark", "Masuit.Tools.ExpressionMapperBenchmark\Masuit.Tools.ExpressionMapperBenchmark.csproj", "{1D51DC49-6626-41AF-B1B5-085C83307FF2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masuit.Tools.NoSQL.MongoDBClient", "Masuit.Tools.NoSQL.MongoDBClient\Masuit.Tools.NoSQL.MongoDBClient.csproj", "{2C4FF8E9-2662-4618-ABA4-BA55AA5EA9AB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -39,18 +33,10 @@ Global
|
||||
{275D5A0D-C49C-497E-A4B5-F40285C2495F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{275D5A0D-C49C-497E-A4B5-F40285C2495F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{275D5A0D-C49C-497E-A4B5-F40285C2495F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1D45BDC4-74C4-4356-8B93-7F7A09106BB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D45BDC4-74C4-4356-8B93-7F7A09106BB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D45BDC4-74C4-4356-8B93-7F7A09106BB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1D45BDC4-74C4-4356-8B93-7F7A09106BB8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{149E6872-CE95-493B-B136-535E64C65A49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{149E6872-CE95-493B-B136-535E64C65A49}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{149E6872-CE95-493B-B136-535E64C65A49}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{149E6872-CE95-493B-B136-535E64C65A49}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{85EEA76D-CDAB-44CB-A08C-A49FDBA4659D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{85EEA76D-CDAB-44CB-A08C-A49FDBA4659D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{85EEA76D-CDAB-44CB-A08C-A49FDBA4659D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{85EEA76D-CDAB-44CB-A08C-A49FDBA4659D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{174474CB-0C9A-4C99-B461-1A2158F00A98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{174474CB-0C9A-4C99-B461-1A2158F00A98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{174474CB-0C9A-4C99-B461-1A2158F00A98}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -59,14 +45,6 @@ Global
|
||||
{82383331-259E-4FB8-BA90-47C0E1AFB4FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{82383331-259E-4FB8-BA90-47C0E1AFB4FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{82383331-259E-4FB8-BA90-47C0E1AFB4FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6CA28B75-2F2D-401A-BDF7-EE314C14C95F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6CA28B75-2F2D-401A-BDF7-EE314C14C95F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6CA28B75-2F2D-401A-BDF7-EE314C14C95F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6CA28B75-2F2D-401A-BDF7-EE314C14C95F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9D2E3A00-9E94-4C3D-AAAE-70B0DA236FE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9D2E3A00-9E94-4C3D-AAAE-70B0DA236FE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9D2E3A00-9E94-4C3D-AAAE-70B0DA236FE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9D2E3A00-9E94-4C3D-AAAE-70B0DA236FE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{91954D82-A5FC-417B-8FD9-D9C165C8F16C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{91954D82-A5FC-417B-8FD9-D9C165C8F16C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{91954D82-A5FC-417B-8FD9-D9C165C8F16C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -83,6 +61,10 @@ Global
|
||||
{1D51DC49-6626-41AF-B1B5-085C83307FF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D51DC49-6626-41AF-B1B5-085C83307FF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1D51DC49-6626-41AF-B1B5-085C83307FF2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2C4FF8E9-2662-4618-ABA4-BA55AA5EA9AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2C4FF8E9-2662-4618-ABA4-BA55AA5EA9AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C4FF8E9-2662-4618-ABA4-BA55AA5EA9AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C4FF8E9-2662-4618-ABA4-BA55AA5EA9AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -90,8 +72,6 @@ Global
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{174474CB-0C9A-4C99-B461-1A2158F00A98} = {E0B8FBD1-A28A-4420-9DE2-6BD06035CBAC}
|
||||
{82383331-259E-4FB8-BA90-47C0E1AFB4FA} = {E0B8FBD1-A28A-4420-9DE2-6BD06035CBAC}
|
||||
{6CA28B75-2F2D-401A-BDF7-EE314C14C95F} = {E0B8FBD1-A28A-4420-9DE2-6BD06035CBAC}
|
||||
{9D2E3A00-9E94-4C3D-AAAE-70B0DA236FE6} = {E0B8FBD1-A28A-4420-9DE2-6BD06035CBAC}
|
||||
{49E16577-01CD-4104-B73E-449B2960D956} = {E0B8FBD1-A28A-4420-9DE2-6BD06035CBAC}
|
||||
{1D51DC49-6626-41AF-B1B5-085C83307FF2} = {E0B8FBD1-A28A-4420-9DE2-6BD06035CBAC}
|
||||
EndGlobalSection
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue"><data><IncludeFilters /><ExcludeFilters><Filter ModuleMask="NetCoreTest" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /><Filter ModuleMask="Test" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /><Filter ModuleMask="Masuit.Tools.UnitTest" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /><Filter ModuleMask="Masuit.Tools.NoSQL.MongoDBClient.Core.UnitTest" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /><Filter ModuleMask="Masuit.Tools.Core.UnitTest" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /></ExcludeFilters></data></s:String></wpf:ResourceDictionary>
|
||||
@@ -1,17 +1,9 @@
|
||||
using Masuit.Tools.Core.NoSQL;
|
||||
using Masuit.Tools.NoSQL;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace NetCoreTest.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public RedisHelper RedisHelper { get; set; }
|
||||
public HomeController(RedisHelperFactory redisHelperFactory)
|
||||
{
|
||||
RedisHelper = redisHelperFactory.Create("aa", 0);// 创建命名为aa的RedisHelper,指定数据库0
|
||||
RedisHelper = redisHelperFactory.CreateDefault(0); // 创建默认的RedisHelper,指定数据库0
|
||||
RedisHelper = redisHelperFactory.CreateLocal(0); // 创建连接本机的RedisHelper,指定数据库0
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,26 +38,9 @@
|
||||
</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MongoDB.Bson, Version=2.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Bson.2.7.3\lib\net45\MongoDB.Bson.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Driver, Version=2.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Driver.2.7.3\lib\net45\MongoDB.Driver.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Driver.Core, Version=2.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Driver.Core.2.7.3\lib\net45\MongoDB.Driver.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\newtonsoft.json\9.0.1\lib\netstandard1.0\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpCompress, Version=0.23.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.23.0\lib\net45\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
@@ -65,7 +48,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Masuit.Tools\Masuit.Tools.csproj">
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DnsClient" version="1.2.0" targetFramework="net45" />
|
||||
<package id="MongoDB.Bson" version="2.7.3" targetFramework="net45" />
|
||||
<package id="MongoDB.Driver" version="2.7.3" targetFramework="net45" />
|
||||
<package id="MongoDB.Driver.Core" version="2.7.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net45" />
|
||||
<package id="SharpCompress" version="0.23.0" targetFramework="net45" />
|
||||
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net45" />
|
||||
<package id="System.Buffers" version="4.4.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net45" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user