First commit

This commit is contained in:
Alexandre Spieser
2016-02-27 12:03:47 +00:00
commit 8852801ceb
80 changed files with 75230 additions and 0 deletions
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
</ApplicationInsights>
@@ -0,0 +1,157 @@
using MongoDB.Driver;
using MongoDbGenericRepository.ViewModels;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace MongoDbGenericRepository
{
public interface IMongoDbRepository
{
/// <summary>
/// A generic GetOne method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
Task<GetOneResult<TEntity>> GetOne<TEntity>(string id) where TEntity : class, new();
/// <summary>
/// A generic GetOne method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
Task<GetOneResult<TEntity>> GetOne<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new();
/// <summary>
/// A generic get many method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="ids"></param>
/// <returns></returns>
Task<GetManyResult<TEntity>> GetMany<TEntity>(IEnumerable<string> ids) where TEntity : class, new();
/// <summary>
/// A generic get many method with filter
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="ids"></param>
/// <returns></returns>
Task<GetManyResult<TEntity>> GetMany<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new();
/// <summary>
/// GetMany with filter and projection
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="filter"></param>
/// <returns>A cursor for the query</returns>
IFindFluent<TEntity, TEntity> FindCursor<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new();
/// <summary>
/// A generic get all method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <returns></returns>
Task<GetManyResult<TEntity>> GetAll<TEntity>() where TEntity : class, new();
/// <summary>
/// A generic Exists method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
Task<bool> Exists<TEntity>(string id) where TEntity : class, new();
/// <summary>
/// A generic count method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
Task<long> Count<TEntity>(string id) where TEntity : class, new();
/// <summary>
/// A generic count method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
Task<long> Count<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new();
/// <summary>
/// A generic Add One method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="item"></param>
/// <returns></returns>
Task<Result> AddOne<TEntity>(TEntity item) where TEntity : class, new();
/// <summary>
/// A generic delete one method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
Task<Result> DeleteOne<TEntity>(string id) where TEntity : class, new();
/// <summary>
/// A generic delete many method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="ids"></param>
/// <returns></returns>
Task<Result> DeleteMany<TEntity>(IEnumerable<string> ids) where TEntity : class, new();
#region Update
/// <summary>
/// UpdateOne by id
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <param name="update"></param>
/// <returns></returns>
Task<Result> UpdateOne<TEntity>(string id, UpdateDefinition<TEntity> update) where TEntity : class, new();
/// <summary>
/// UpdateOne with filter
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="filter"></param>
/// <param name="update"></param>
/// <returns></returns>
Task<Result> UpdateOne<TEntity>(FilterDefinition<TEntity> filter, UpdateDefinition<TEntity> update) where TEntity : class, new();
/// <summary>
/// UpdateMany with Ids
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <param name="update"></param>
/// <returns></returns>
Task<Result> UpdateMany<TEntity>(IEnumerable<string> ids, UpdateDefinition<TEntity> update) where TEntity : class, new();
/// <summary>
/// UpdateMany with filter
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="filter"></param>
/// <param name="update"></param>
/// <returns></returns>
Task<Result> UpdateMany<TEntity>(FilterDefinition<TEntity> filter, UpdateDefinition<TEntity> update) where TEntity : class, new();
#endregion Update
#region Find And Update
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="filter"></param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
Task<GetOneResult<TEntity>> GetAndUpdateOne<TEntity>(FilterDefinition<TEntity> filter, UpdateDefinition<TEntity> update, FindOneAndUpdateOptions<TEntity, TEntity> options) where TEntity : class, new();
#endregion Find And Update
}
}
@@ -0,0 +1,30 @@
using MongoDB.Driver;
using System.Configuration;
namespace MongoDbGenericRepository
{
public class MongoDbContext
{
public const string CONNECTION_STRING_NAME = "MongoDbTest";
public const string DATABASE_NAME = "MongoDbTest";
private static readonly IMongoClient _client;
private static readonly IMongoDatabase _database;
static MongoDbContext()
{
var connectionString = ConfigurationManager.ConnectionStrings[CONNECTION_STRING_NAME].ConnectionString;
_client = new MongoClient(connectionString);
_database = _client.GetDatabase(DATABASE_NAME);
}
/// <summary>
/// The private GetCollection method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <returns></returns>
public IMongoCollection<TEntity> GetCollection<TEntity>()
{
return _database.GetCollection<TEntity>(typeof(TEntity).Name.ToLower() + "s");
}
}
}
@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.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>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D154E7D0-9A3C-43AB-8E90-ED92BC4343F0}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MongoDbGenericRepository</RootNamespace>
<AssemblyName>MongoDbGenericRepository</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</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\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="MongoDB.Bson, Version=2.2.3.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Bson.2.2.3\lib\net45\MongoDB.Bson.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MongoDB.Driver, Version=2.2.3.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.2.2.3\lib\net45\MongoDB.Driver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MongoDB.Driver.Core, Version=2.2.3.3, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Driver.Core.2.2.3\lib\net45\MongoDB.Driver.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="packages.config" />
<Content Include="ApplicationInsights.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="IMongoDbRepository.cs" />
<Compile Include="MongoDbContext.cs" />
<Compile Include="MongoDbRepository.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\HelperService.cs" />
<Compile Include="ViewModels\Results.cs" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>52313</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:52313/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target>
<!-- 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>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>
</StartPageUrl>
<StartAction>CurrentPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
<NativeDebugging>False</NativeDebugging>
<SQLDebugging>False</SQLDebugging>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>True</EnableENC>
<AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,429 @@
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using MongoDbGenericRepository.ViewModels;
using System.Threading.Tasks;
using MongoDbGenericRepository.Services;
using MongoDB.Bson;
namespace MongoDbGenericRepository
{
public class MongoRepository : IMongoDbRepository
{
private MongoDbContext _mongoDbContext = null;
public MongoRepository(MongoDbContext mongoDbContext = null)
{
_mongoDbContext = mongoDbContext != null ? mongoDbContext : new MongoDbContext();
}
#region Get
/// <summary>
/// A generic GetOne method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
public async Task<GetOneResult<TEntity>> GetOne<TEntity>(string id) where TEntity : class, new()
{
var filter = Builders<TEntity>.Filter.Eq("Id", id);
return await GetOne<TEntity>(filter);
}
/// <summary>
/// A generic GetOne method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
public async Task<GetOneResult<TEntity>> GetOne<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new()
{
var res = new GetOneResult<TEntity>();
try
{
var collection = GetCollection<TEntity>();
var entity = await collection.Find(filter).SingleOrDefaultAsync();
if (entity != null)
{
res.Entity = entity;
}
res.Success = true;
return res;
}
catch (Exception ex)
{
res.Message = HelperService.NotifyException("GetOne", "Exception getting one " + typeof(TEntity).Name, ex);
return res;
}
}
/// <summary>
/// A generic get many method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<GetManyResult<TEntity>> GetMany<TEntity>(IEnumerable<string> ids) where TEntity : class, new()
{
try
{
var collection = GetCollection<TEntity>();
var filter = Builders<TEntity>.Filter.Eq("Id", ids);
return await GetMany<TEntity>(filter);
}
catch (Exception ex)
{
var res = new GetManyResult<TEntity>();
res.Message = HelperService.NotifyException("GetMany", "Exception getting many " + typeof(TEntity).Name + "s", ex);
return res;
}
}
/// <summary>
/// A generic get many method with filter
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<GetManyResult<TEntity>> GetMany<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new()
{
var res = new GetManyResult<TEntity>();
try
{
var collection = GetCollection<TEntity>();
var entities = await collection.Find(filter).ToListAsync();
if (entities != null)
{
res.Entities = entities;
}
res.Success = true;
return res;
}
catch (Exception ex)
{
res.Message = HelperService.NotifyException("GetMany", "Exception getting many " + typeof(TEntity).Name + "s", ex);
return res;
}
}
/// <summary>
/// FindCursor
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="filter"></param>
/// <returns>A cursor for the query</returns>
public IFindFluent<TEntity, TEntity> FindCursor<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new()
{
var res = new GetManyResult<TEntity>();
var collection = GetCollection<TEntity>();
var cursor = collection.Find(filter);
return cursor;
}
/// <summary>
/// A generic get all method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <returns></returns>
public async Task<GetManyResult<TEntity>> GetAll<TEntity>() where TEntity : class, new()
{
var res = new GetManyResult<TEntity>();
try
{
var collection = GetCollection<TEntity>();
var entities = await collection.Find(new BsonDocument()).ToListAsync();
if (entities != null)
{
res.Entities = entities;
}
res.Success = true;
return res;
}
catch (Exception ex)
{
res.Message = HelperService.NotifyException("GetAll", "Exception getting all " + typeof(TEntity).Name + "s", ex);
return res;
}
}
/// <summary>
/// A generic Exists method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public async Task<bool> Exists<TEntity>(string id) where TEntity : class, new()
{
var collection = GetCollection<TEntity>();
var query = new BsonDocument("Id", id);
var cursor = collection.Find(query);
var count = await cursor.CountAsync();
return (count > 0);
}
/// <summary>
/// A generic count method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
public async Task<long> Count<TEntity>(string id) where TEntity : class, new()
{
var filter = new FilterDefinitionBuilder<TEntity>().Eq("Id", id);
return await Count<TEntity>(filter);
}
/// <summary>
/// A generic count method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
public async Task<long> Count<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new()
{
var collection = GetCollection<TEntity>();
var cursor = collection.Find(filter);
var count = await cursor.CountAsync();
return count;
}
#endregion Get
#region Create
/// <summary>
/// A generic Add One method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="item"></param>
/// <returns></returns>
public async Task<Result> AddOne<TEntity>(TEntity item) where TEntity : class, new()
{
var res = new Result();
try
{
var collection = GetCollection<TEntity>();
await collection.InsertOneAsync(item);
res.Success = true;
res.Message = "OK";
return res;
}
catch (Exception ex)
{
res.Message = HelperService.NotifyException("AddOne", "Exception adding one " + typeof(TEntity).Name, ex);
return res;
}
}
#endregion Create
#region Delete
/// <summary>
/// A generic delete one method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
public async Task<Result> DeleteOne<TEntity>(string id) where TEntity : class, new()
{
var filter = new FilterDefinitionBuilder<TEntity>().Eq("Id", id);
return await DeleteOne<TEntity>(filter);
}
/// <summary>
/// A generic delete one method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <returns></returns>
public async Task<Result> DeleteOne<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new()
{
var result = new Result();
try
{
var collection = GetCollection<TEntity>();
var deleteRes = await collection.DeleteOneAsync(filter);
result.Success = true;
result.Message = "OK";
return result;
}
catch (Exception ex)
{
result.Message = HelperService.NotifyException("DeleteOne", "Exception deleting one " + typeof(TEntity).Name, ex);
return result;
}
}
/// <summary>
/// A generic delete many method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<Result> DeleteMany<TEntity>(IEnumerable<string> ids) where TEntity : class, new()
{
var filter = new FilterDefinitionBuilder<TEntity>().In("Id", ids);
return await DeleteMany<TEntity>(filter);
}
/// <summary>
/// A generic delete many method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<Result> DeleteMany<TEntity>(FilterDefinition<TEntity> filter) where TEntity : class, new()
{
var result = new Result();
try
{
var collection = GetCollection<TEntity>();
var deleteRes = await collection.DeleteManyAsync(filter);
if (deleteRes.DeletedCount < 1)
{
var ex = new Exception();
result.Message = HelperService.NotifyException("DeleteMany", "Some " + typeof(TEntity).Name + "s could not be deleted.", ex);
return result;
}
result.Success = true;
result.Message = "OK";
return result;
}
catch (Exception ex)
{
result.Message = HelperService.NotifyException("DeleteMany", "Some " + typeof(TEntity).Name + "s could not be deleted.", ex);
return result;
}
}
#endregion Delete
#region Update
/// <summary>
/// UpdateOne by id
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <param name="update"></param>
/// <returns></returns>
public async Task<Result> UpdateOne<TEntity>(string id, UpdateDefinition<TEntity> update) where TEntity : class, new()
{
var filter = new FilterDefinitionBuilder<TEntity>().Eq("Id", id);
return await UpdateOne<TEntity>(filter, update);
}
/// <summary>
/// UpdateOne with filter
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="filter"></param>
/// <param name="update"></param>
/// <returns></returns>
public async Task<Result> UpdateOne<TEntity>(FilterDefinition<TEntity> filter, UpdateDefinition<TEntity> update) where TEntity : class, new()
{
var result = new Result();
try
{
var collection = GetCollection<TEntity>();
var updateRes = await collection.UpdateOneAsync(filter, update);
if (updateRes.ModifiedCount < 1)
{
var ex = new Exception();
result.Message = HelperService.NotifyException("UpdateOne", "ERROR: updateRes.ModifiedCount < 1 for entity: " + typeof(TEntity).Name, ex);
return result;
}
result.Success = true;
result.Message = "OK";
return result;
}
catch (Exception ex)
{
result.Message = HelperService.NotifyException("UpdateOne", "Exception updating entity: " + typeof(TEntity).Name, ex);
return result;
}
}
/// <summary>
/// UpdateMany with Ids
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="id"></param>
/// <param name="update"></param>
/// <returns></returns>
public async Task<Result> UpdateMany<TEntity>(IEnumerable<string> ids, UpdateDefinition<TEntity> update) where TEntity : class, new()
{
var filter = new FilterDefinitionBuilder<TEntity>().In("Id", ids);
return await UpdateOne<TEntity>(filter, update);
}
/// <summary>
/// UpdateMany with filter
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="filter"></param>
/// <param name="update"></param>
/// <returns></returns>
public async Task<Result> UpdateMany<TEntity>(FilterDefinition<TEntity> filter, UpdateDefinition<TEntity> update) where TEntity : class, new()
{
var result = new Result();
try
{
var collection = GetCollection<TEntity>();
var updateRes = await collection.UpdateManyAsync(filter, update);
if (updateRes.ModifiedCount < 1)
{
var ex = new Exception();
result.Message = HelperService.NotifyException("UpdateMany", "ERROR: updateRes.ModifiedCount < 1 for entities: " + typeof(TEntity).Name + "s", ex);
return result;
}
result.Success = true;
result.Message = "OK";
return result;
}
catch (Exception ex)
{
result.Message = HelperService.NotifyException("UpdateMany", "Exception updating entities: " + typeof(TEntity).Name + "s", ex);
return result;
}
}
#endregion Update
#region Find And Update
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="filter"></param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public async Task<GetOneResult<TEntity>> GetAndUpdateOne<TEntity>(FilterDefinition<TEntity> filter, UpdateDefinition<TEntity> update, FindOneAndUpdateOptions<TEntity, TEntity> options) where TEntity : class, new()
{
var result = new GetOneResult<TEntity>();
try
{
var collection = GetCollection<TEntity>();
result.Entity = await collection.FindOneAndUpdateAsync(filter, update, options);
result.Success = true;
result.Message = "OK";
return result;
}
catch (Exception ex)
{
result.Message = HelperService.NotifyException("GetAndUpdateOne", "Exception getting and updating entity: " + typeof(TEntity).Name, ex);
return result;
}
}
#endregion Find And Update
/// <summary>
/// The private GetCollection method
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <returns></returns>
private IMongoCollection<TEntity> GetCollection<TEntity>()
{
return _mongoDbContext.GetCollection<TEntity>();
}
}
}
@@ -0,0 +1,35 @@
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("MongoDbGenericRepository")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MongoDbGenericRepository")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("d154e7d0-9a3c-43ab-8e90-ed92bc4343f0")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,61 @@
using System;
using System.Diagnostics;
using System.Text;
namespace MongoDbGenericRepository.Services
{
public static class HelperService
{
public static string NotifyException(string FunctionName, string Context, Exception ex)
{
string source = FunctionName + ": " + Context;
source = GetAllInformation(ex, source);
Debug.WriteLine(source);
return source;
}
/// <summary>
/// Get all exception information
/// </summary>
/// <param name="exception"></param>
/// <param name="information"></param>
/// <returns></returns>
public static string GetAllInformation(Exception exception, string source)
{
var sb = new StringBuilder();
sb.AppendLine("********** " + DateTime.Now.ToLongDateString() + "**********");
while (exception != null)
{
sb.AppendLine("Inner Exception Type: ");
sb.AppendLine(exception.InnerException.GetType().ToString());
sb.AppendLine("Inner Exception: ");
sb.AppendLine(exception.InnerException.Message);
sb.AppendLine("Inner Source: ");
sb.AppendLine(exception.InnerException.Source);
if (exception.InnerException.StackTrace != null)
{
sb.AppendLine("Inner Stack Trace: ");
sb.AppendLine(exception.InnerException.StackTrace);
}
sb.AppendLine("Exception Type: ");
sb.AppendLine(sb.GetType().ToString());
sb.AppendLine("Exception: " + exception.Message);
sb.AppendLine("Source: " + source);
sb.AppendLine("Stack Trace: ");
if (exception.StackTrace != null)
{
sb.AppendLine(exception.StackTrace);
sb.AppendLine();
}
exception = exception.InnerException;
}
return sb.ToString();
}
}
}
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MongoDbGenericRepository.ViewModels
{
public class Result
{
public bool Success { get; set; }
public string Message { get; set; }
public int ErrorCode { get; set; }
public Result()
{
Success = false;
Message = "";
ErrorCode = 500;
}
}
public class GetOneResult<TEntity> : Result where TEntity : class, new()
{
public TEntity Entity { get; set; }
}
public class GetManyResult<TEntity> : Result where TEntity : class, new()
{
public IEnumerable<TEntity> Entities { get; set; }
}
public class GetListResult<T> : Result
{
public List<T> Entities { get; set; }
}
}
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an attribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
<httpModules>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
</compilers>
</system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
</modules>
</system.webServer>
</configuration>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
</ApplicationInsights>
@@ -0,0 +1,40 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Microsoft.CodeDom.Providers.DotNetCompilerPlatform</name>
</assembly>
<members>
<member name="T:Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider">
<summary>
Provides access to instances of the .NET Compiler Platform C# code generator and code compiler.
</summary>
</member>
<member name="M:Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider.#ctor">
<summary>
Default Constructor
</summary>
</member>
<member name="M:Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider.CreateCompiler">
<summary>
Gets an instance of the .NET Compiler Platform C# code compiler.
</summary>
<returns>An instance of the .NET Compiler Platform C# code compiler</returns>
</member>
<member name="T:Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider">
<summary>
Provides access to instances of the .NET Compiler Platform VB code generator and code compiler.
</summary>
</member>
<member name="M:Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider.#ctor">
<summary>
Default Constructor
</summary>
</member>
<member name="M:Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider.CreateCompiler">
<summary>
Gets an instance of the .NET Compiler Platform VB code compiler.
</summary>
<returns>An instance of the .NET Compiler Platform VB code compiler</returns>
</member>
</members>
</doc>
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
<httpModules>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
</compilers>
</system.codedom>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
</modules>
</system.webServer>
</configuration>
@@ -0,0 +1,135 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target
Name="CoreCompile"
Inputs="$(MSBuildAllProjects);
@(Compile);
@(_CoreCompileResourceInputs);
$(ApplicationIcon);
$(AssemblyOriginatorKeyFile);
@(ReferencePath);
@(CompiledLicenseFile);
@(LinkResource);
@(EmbeddedDocumentation);
$(Win32Resource);
$(Win32Manifest);
@(CustomAdditionalCompileInputs);
$(ResolvedCodeAnalysisRuleSet)"
Outputs="@(DocFileItem);
@(IntermediateAssembly);
@(_DebugSymbolsIntermediatePath);
$(NonExistentFile);
@(CustomAdditionalCompileOutputs)"
Returns=""
DependsOnTargets="$(CoreCompileDependsOn)"
>
<!-- These two compiler warnings are raised when a reference is bound to a different version
than specified in the assembly reference version number. MSBuild raises the same warning in this case,
so the compiler warning would be redundant. -->
<PropertyGroup Condition="('$(TargetFrameworkVersion)' != 'v1.0') and ('$(TargetFrameworkVersion)' != 'v1.1')">
<NoWarn>$(NoWarn);1701;1702</NoWarn>
</PropertyGroup>
<PropertyGroup>
<!-- To match historical behavior, when inside VS11+ disable the warning from csc.exe indicating that no sources were passed in-->
<NoWarn Condition=" '$(BuildingInsideVisualStudio)' == 'true' and '$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' > '10.0' ">$(NoWarn);2008</NoWarn>
</PropertyGroup>
<ItemGroup Condition="'$(TargetingClr2Framework)'=='true'">
<ReferencePath>
<EmbedInteropTypes/>
</ReferencePath>
</ItemGroup>
<PropertyGroup>
<!-- If the user has specified AppConfigForCompiler, we'll use it. If they have not, but they set UseAppConfigForCompiler,
then we'll use AppConfig -->
<AppConfigForCompiler Condition="'$(AppConfigForCompiler)' == '' and '$(UseAppConfigForCompiler)' == 'true'">$(AppConfig)</AppConfigForCompiler>
<!-- If we are targeting winmdobj we want to specifically the pdbFile property since we do not want it to collide with the output of winmdexp-->
<PdbFile Condition="'$(PdbFile)' == '' and '$(OutputType)' == 'winmdobj' and '$(_DebugSymbolsProduced)' == 'true'">$(IntermediateOutputPath)$(TargetName).compile.pdb</PdbFile>
</PropertyGroup>
<!-- Prefer32Bit was introduced in .NET 4.5. Set it to false if we are targeting 4.0 -->
<PropertyGroup Condition="('$(TargetFrameworkVersion)' == 'v4.0')">
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup Condition="('$(AdditionalFileItemNames)' != '')">
<AdditionalFileItems Include="$(AdditionalFileItemNames)" />
<AdditionalFiles Include="@(%(AdditionalFileItems.Identity))" />
</ItemGroup>
<PropertyGroup Condition="'$(UseSharedCompilation)' == ''">
<UseSharedCompilation>true</UseSharedCompilation>
</PropertyGroup>
<!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler -->
<Csc Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
AdditionalLibPaths="$(AdditionalLibPaths)"
AddModules="@(AddModules)"
AdditionalFiles="@(AdditionalFiles)"
AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
Analyzers="@(Analyzer)"
ApplicationConfiguration="$(AppConfigForCompiler)"
BaseAddress="$(BaseAddress)"
CheckForOverflowUnderflow="$(CheckForOverflowUnderflow)"
CodeAnalysisRuleSet="$(ResolvedCodeAnalysisRuleSet)"
CodePage="$(CodePage)"
DebugType="$(DebugType)"
DefineConstants="$(DefineConstants)"
DelaySign="$(DelaySign)"
DisabledWarnings="$(NoWarn)"
DocumentationFile="@(DocFileItem)"
EmitDebugInformation="$(DebugSymbols)"
EnvironmentVariables="$(CscEnvironment)"
ErrorEndLocation="$(ErrorEndLocation)"
ErrorLog="$(ErrorLog)"
ErrorReport="$(ErrorReport)"
FileAlignment="$(FileAlignment)"
GenerateFullPaths="$(GenerateFullPaths)"
HighEntropyVA="$(HighEntropyVA)"
KeyContainer="$(KeyContainerName)"
KeyFile="$(KeyOriginatorFile)"
LangVersion="$(LangVersion)"
LinkResources="@(LinkResource)"
MainEntryPoint="$(StartupObject)"
ModuleAssemblyName="$(ModuleAssemblyName)"
NoConfig="true"
NoLogo="$(NoLogo)"
NoStandardLib="$(NoCompilerStandardLib)"
NoWin32Manifest="$(NoWin32Manifest)"
Optimize="$(Optimize)"
OutputAssembly="@(IntermediateAssembly)"
PdbFile="$(PdbFile)"
Platform="$(PlatformTarget)"
Prefer32Bit="$(Prefer32Bit)"
PreferredUILang="$(PreferredUILang)"
References="@(ReferencePath)"
ReportAnalyzer="$(ReportAnalyzer)"
Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile)"
ResponseFiles="$(CompilerResponseFile)"
Sources="@(Compile)"
SubsystemVersion="$(SubsystemVersion)"
TargetType="$(OutputType)"
ToolExe="$(CscToolExe)"
ToolPath="$(CscToolPath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
UseHostCompilerIfAvailable="$(UseHostCompilerIfAvailable)"
UseSharedCompilation="$(UseSharedCompilation)"
Utf8Output="$(Utf8Output)"
VsSessionGuid="$(VsSessionGuid)"
WarningLevel="$(WarningLevel)"
WarningsAsErrors="$(WarningsAsErrors)"
WarningsNotAsErrors="$(WarningsNotAsErrors)"
Win32Icon="$(ApplicationIcon)"
Win32Manifest="$(Win32Manifest)"
Win32Resource="$(Win32Resource)"
/>
<ItemGroup>
<_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
</ItemGroup>
<CallTarget Targets="$(TargetsTriggeredByCompilation)" Condition="'$(TargetsTriggeredByCompilation)' != ''"/>
</Target>
</Project>
@@ -0,0 +1,133 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target
Name="CoreCompile"
Inputs="$(MSBuildAllProjects);
@(Compile);
@(_CoreCompileResourceInputs);
$(ApplicationIcon);
$(AssemblyOriginatorKeyFile);
@(ReferencePath);
@(CompiledLicenseFile);
@(LinkResource);
@(EmbeddedDocumentation);
$(Win32Resource);
$(Win32Manifest);
@(CustomAdditionalCompileInputs);
$(ResolvedCodeAnalysisRuleSet)"
Outputs="@(DocFileItem);
@(IntermediateAssembly);
@(_DebugSymbolsIntermediatePath);
$(NonExistentFile);
@(CustomAdditionalCompileOutputs)"
Returns=""
DependsOnTargets="$(CoreCompileDependsOn)"
>
<PropertyGroup>
<_NoWarnings Condition=" '$(WarningLevel)' == '0' ">true</_NoWarnings>
<_NoWarnings Condition=" '$(WarningLevel)' == '1' ">false</_NoWarnings>
</PropertyGroup>
<PropertyGroup>
<!-- If we are targeting winmdobj we want to specifically the pdbFile property since we do not want it to collide with the output of winmdexp-->
<PdbFile Condition="'$(PdbFile)' == '' and '$(OutputType)' == 'winmdobj' and '$(DebugSymbols)' == 'true'">$(IntermediateOutputPath)$(TargetName).compile.pdb</PdbFile>
</PropertyGroup>
<ItemGroup Condition="'$(TargetingClr2Framework)'=='true'">
<ReferencePath>
<EmbedInteropTypes/>
</ReferencePath>
</ItemGroup>
<!-- Prefer32Bit was introduced in .NET 4.5. Set it to false if we are targeting 4.0 -->
<PropertyGroup Condition="('$(TargetFrameworkVersion)' == 'v4.0')">
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup Condition="('$(AdditionalFileItemNames)' != '')">
<AdditionalFileItems Include="$(AdditionalFileItemNames)" />
<AdditionalFiles Include="@(%(AdditionalFileItems.Identity))" />
</ItemGroup>
<PropertyGroup Condition="'$(UseSharedCompilation)' == ''">
<UseSharedCompilation>true</UseSharedCompilation>
</PropertyGroup>
<!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler -->
<Vbc Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
AdditionalLibPaths="$(AdditionalLibPaths)"
AddModules="@(AddModules)"
AdditionalFiles="@(AdditionalFiles)"
Analyzers="@(Analyzer)"
BaseAddress="$(BaseAddress)"
CodeAnalysisRuleSet="$(ResolvedCodeAnalysisRuleSet)"
CodePage="$(CodePage)"
DebugType="$(DebugType)"
DefineConstants="$(FinalDefineConstants)"
DelaySign="$(DelaySign)"
DisabledWarnings="$(NoWarn)"
DocumentationFile="@(DocFileItem)"
EmitDebugInformation="$(DebugSymbols)"
EnvironmentVariables="$(VbcEnvironment)"
ErrorLog="$(ErrorLog)"
ErrorReport="$(ErrorReport)"
FileAlignment="$(FileAlignment)"
GenerateDocumentation="$(GenerateDocumentation)"
HighEntropyVA="$(HighEntropyVA)"
Imports="@(Import)"
KeyContainer="$(KeyContainerName)"
KeyFile="$(KeyOriginatorFile)"
LangVersion="$(LangVersion)"
LinkResources="@(LinkResource)"
MainEntryPoint="$(StartupObject)"
ModuleAssemblyName="$(ModuleAssemblyName)"
NoConfig="true"
NoStandardLib="$(NoCompilerStandardLib)"
NoVBRuntimeReference="$(NoVBRuntimeReference)"
NoWarnings="$(_NoWarnings)"
NoWin32Manifest="$(NoWin32Manifest)"
Optimize="$(Optimize)"
OptionCompare="$(OptionCompare)"
OptionExplicit="$(OptionExplicit)"
OptionInfer="$(OptionInfer)"
OptionStrict="$(OptionStrict)"
OptionStrictType="$(OptionStrictType)"
OutputAssembly="@(IntermediateAssembly)"
PdbFile="$(PdbFile)"
Platform="$(PlatformTarget)"
Prefer32Bit="$(Prefer32Bit)"
PreferredUILang="$(PreferredUILang)"
References="@(ReferencePath)"
RemoveIntegerChecks="$(RemoveIntegerChecks)"
ReportAnalyzer="$(ReportAnalyzer)"
Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile)"
ResponseFiles="$(CompilerResponseFile)"
RootNamespace="$(RootNamespace)"
SdkPath="$(FrameworkPathOverride)"
Sources="@(Compile)"
SubsystemVersion="$(SubsystemVersion)"
TargetCompactFramework="$(TargetCompactFramework)"
TargetType="$(OutputType)"
ToolExe="$(VbcToolExe)"
ToolPath="$(VbcToolPath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
UseHostCompilerIfAvailable="$(UseHostCompilerIfAvailable)"
UseSharedCompilation="$(UseSharedCompilation)"
Utf8Output="$(Utf8Output)"
VBRuntimePath="$(VBRuntimePath)"
Verbosity="$(VbcVerbosity)"
VsSessionGuid="$(VsSessionGuid)"
WarningsAsErrors="$(WarningsAsErrors)"
WarningsNotAsErrors="$(WarningsNotAsErrors)"
Win32Icon="$(ApplicationIcon)"
Win32Manifest="$(Win32Manifest)"
Win32Resource="$(Win32Resource)"
VBRuntime="$(VBRuntime)"
/>
<ItemGroup>
<_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
</ItemGroup>
<CallTarget Targets="$(TargetsTriggeredByCompilation)" Condition="'$(TargetsTriggeredByCompilation)' != ''"/>
</Target>
</Project>
Binary file not shown.
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<configuration>
<runtime>
<gcServer enabled="true"/>
<gcConcurrent enabled="false"/>
</runtime>
<appSettings>
<!-- Number of seconds with no activity before the server times out and closes.
Set to -1 to never shut down the server. -->
<add key="keepalive" value="600"/>
</appSettings>
</configuration>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\csc.exe
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\Microsoft.CodeAnalysis.CSharp.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\Microsoft.CodeAnalysis.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\Microsoft.CodeAnalysis.VisualBasic.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\Microsoft.CSharp.Core.targets
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\Microsoft.VisualBasic.Core.targets
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\System.Collections.Immutable.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\System.Reflection.Metadata.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\vbc.exe
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\VBCSCompiler.exe
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\roslyn\VBCSCompiler.exe.config
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\MongoDbGenericRepository.dll.config
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\MongoDbGenericRepository.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\MongoDbGenericRepository.pdb
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\MongoDB.Bson.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\MongoDB.Driver.Core.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\MongoDB.Driver.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\MongoDB.Bson.xml
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\MongoDB.Driver.xml
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\obj\Debug\MongoDbGenericRepository.dll
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\obj\Debug\MongoDbGenericRepository.pdb
c:\users\alex\documents\visual studio 2015\Projects\MongoDbGenericRepository\MongoDbGenericRepository\bin\ApplicationInsights.config
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
<package id="MongoDB.Bson" version="2.2.3" targetFramework="net452" />
<package id="MongoDB.Driver" version="2.2.3" targetFramework="net452" />
<package id="MongoDB.Driver.Core" version="2.2.3" targetFramework="net452" />
</packages>