Skip to content

Commit

Permalink
Support for lower .NETCore frameworks (#10)
Browse files Browse the repository at this point in the history
* Support for lower .NETCore frameworks
* Reference project instead of nuget in samples
  • Loading branch information
Philippe Birbaum authored Dec 7, 2019
1 parent 3272250 commit 106d528
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.0.100"
"version": "3.1.100"
}
}
5 changes: 3 additions & 2 deletions samples/Context/DataAccess/DataAccess.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>SimpleBlog.DataAccess</AssemblyName>
<RootNamespace>SimpleBlog.DataAccess</RootNamespace>
<IsPackable>false</IsPackable>
Expand All @@ -11,11 +11,12 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.0" />
<PackageReference Include="MongoDB.Extensions.Context" Version="0.1.0-preview3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Models\Models.csproj" />

<ProjectReference Include="..\..\..\src\Context\Context.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Context.Tests/Context.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFrameworks>netcoreapp2.2;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<AssemblyName>MongoDB.Extensions.Context.Tests</AssemblyName>
<RootNamespace>MongoDB.Extensions.Context.Tests</RootNamespace>
<IsPackable>false</IsPackable>
Expand Down
11 changes: 6 additions & 5 deletions src/Context.Tests/MongoCollectionBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public void WithMongoCollectionSettings_NoCollectionSettingsConfigured_DefaultMo
Assert.True(result.Settings.AssignIdOnInsert);
}

#if NETCOREAPP3_1
[Fact]
public void WithMongoCollectionSettings_DefaultCollectionSettingsConfigured_DefaultMongoCollectionSettingsSet()
{
Expand All @@ -187,10 +188,10 @@ public void WithMongoCollectionSettings_DefaultCollectionSettingsConfigured_Defa
Assert.Equal(ReadPreference.Primary, result.Settings.ReadPreference);
Assert.True(result.Settings.AssignIdOnInsert);
}
#endif
#endregion

#endregion

#region WithMongoCollectionConfiguration Tests
#region WithMongoCollectionConfiguration Tests

[Fact]
public void WithMongoCollectionConfiguration_ChangeCollectionConfiguration_MongoCollectionConfigurationChangedSuccessfully()
Expand All @@ -211,9 +212,9 @@ public void WithMongoCollectionConfiguration_ChangeCollectionConfiguration_Mongo
//
List<BsonDocument> indexes = result.Indexes.List().ToList();
Assert.Equal("_id_", indexes.First().GetElement("name").Value.ToString());
Assert.Equal("Name_1", indexes.Last().GetElement("name").Value.ToString());
Assert.Equal("Name_1".ToLower(), indexes.Last().GetElement("name").Value.ToString().ToLower());
}

#endregion
#endregion
}
}
21 changes: 18 additions & 3 deletions src/Context/Context.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(CCResourceProjectProps)" Condition="Exists('$(CCResourceProjectProps)')" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<AssemblyName>MongoDB.Extensions.Context</AssemblyName>
<RootNamespace>MongoDB.Extensions.Context</RootNamespace>
<PackageId>MongoDB.Extensions.Context</PackageId>
Expand All @@ -20,10 +20,25 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.9.3" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.0" />
<PackageReference Include="MongoDB.Driver" Version="2.9.3" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.0" />
</ItemGroup>

</Project>

0 comments on commit 106d528

Please sign in to comment.