Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- release/**
- feature/**
pull_request:
branches:
- main
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
6.x
7.0.x
8.0.x
9.0.x

- name: Build
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x
dotnet-version: 9.x

- run: dotnet tool update -g docfx
- run: docfx docs/docfx.json
Expand Down
41 changes: 17 additions & 24 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
BSD 3-Clause License
MIT License

Copyright (c) 2023-2024, Electronic Hands Ltd
Copyright (c) 2024 Electronic Hands

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ For more detailed information about Primitively, check out [primitively.net][pri
To get started, first add the [Primitively](https://www.nuget.org/packages/Primitively/) NuGet package to your project by running the following command:

```sh
dotnet add package Primitively --prerelease
dotnet add package Primitively
```

Open your csproj file and edit the package reference, setting `PrivateAssets="All"`. The file will look something like this afterwards:
Expand All @@ -51,13 +51,13 @@ Open your csproj file and edit the package reference, setting `PrivateAssets="Al
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Primitively" Version="1.4.15-rc.3" PrivateAssets="All" />
<PackageReference Include="Primitively" Version="1.4.22" PrivateAssets="All" />
</ItemGroup>

</Project>
Expand Down Expand Up @@ -105,19 +105,19 @@ Here's some source generation in action using each of the above attributes: -
If you want to use your Primitively types in an ASP.NET core web project. Add the [Primitively.AspNetCore.Mvc](https://www.nuget.org/packages/Primitively.AspNetCore.Mvc/) NuGet package to your project by running the following command. It contains model binding support for your Primitively types, which means you can use your Primitively types in request parameters.

```sh
dotnet add package Primitively.AspNetCore.Mvc --prerelease
dotnet add package Primitively.AspNetCore.Mvc
```

If you are also generating **swagger** documentation for a web API. Add the [Primitively.AspNetCore.SwaggerGen](https://www.nuget.org/packages/Primitively.AspNetCore.SwaggerGen/) NuGet package to your project by running the following command.

```sh
dotnet add package Primitively.AspNetCore.SwaggerGen --prerelease
dotnet add package Primitively.AspNetCore.SwaggerGen
```

When using `FluentValidation` to validate your web requests. Add the [Primitively.FluentValidation](https://www.nuget.org/packages/Primitively.FluentValidation/) NuGet package to your project by running the following command. It contains two extension methods which validate any Primitively type with zero DI configuration.

```sh
dotnet add package Primitively.FluentValidation --prerelease
dotnet add package Primitively.FluentValidation
```

### Dependency injection
Expand Down Expand Up @@ -152,7 +152,7 @@ builder.Services.AddPrimitively(options =>
If you want to store your Primitively types in MongoDB they will need a BSON serializer. Add the [Primitively.MongoDB.Bson](https://www.nuget.org/packages/Primitively.MongoDB.Bson/) NuGet package to your project by running the following command. It contains highly configurable BSON serialization support for your Primitively types.

```sh
dotnet add package Primitively.MongoDB.Bson --prerelease
dotnet add package Primitively.MongoDB.Bson
```

### Dependency injection
Expand Down Expand Up @@ -209,6 +209,6 @@ Sample applications that demonstrate scenarios in which Primitively is commonly

## Licence

Licensed under the terms of the [New BSD License](https://opensource.org/license/bsd-3-clause/)
Licensed under the terms of the [MIT License](https://opensource.org/license/mit/)

[primitively-website]: https://primitively.net
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Primitively" Version="1.4.15-rc.3" PrivateAssets="All" />
<PackageReference Include="Primitively" Version="1.4.20" PrivateAssets="All" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Primitively" Version="1.4.15-rc.3" PrivateAssets="All" />
<PackageReference Include="Primitively" Version="1.4.20" PrivateAssets="All" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Primitively" Version="1.4.15-rc.3" PrivateAssets="All" />
<PackageReference Include="Primitively" Version="1.4.20" PrivateAssets="All" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<!--
To target netstandard2.0, the below props are required to support some features introduced after netstandard2.0 and
the c# 7.3 lang version release dates, such as 'record structs' which came with c# 10.
To target netstandard2.0, the c# 10 lang version (available in net6.0) must be used to support 'record structs'.
This is not recommended for production use, but is used here to demonstrate the use of Primitively on older versions of .NET.
-->

<PropertyGroup>
Expand All @@ -13,13 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Primitively" Version="1.4.15-rc.3" PrivateAssets="All" />
<PackageReference Include="IsExternalInit" Version="1.0.3"><!--Adds support for 'record'-->
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="8.0.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="Primitively" Version="1.4.20" PrivateAssets="All" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Primitively" Version="1.4.15-rc.3" PrivateAssets="all" />
<PackageReference Include="Primitively" Version="1.4.20" PrivateAssets="all" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="MongoDB.Driver" Version="2.24.0" />
<PackageReference Include="Primitively.AspNetCore.Mvc" Version="1.4.15-rc.3" />
<PackageReference Include="Primitively.AspNetCore.SwaggerGen" Version="1.4.15-rc.3" />
<PackageReference Include="Primitively.MongoDB.Bson" Version="1.4.15-rc.3" />
<PackageReference Include="Primitively.AspNetCore.Mvc" Version="1.4.20" />
<PackageReference Include="Primitively.AspNetCore.SwaggerGen" Version="1.4.20" />
<PackageReference Include="Primitively.MongoDB.Bson" Version="1.4.20" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PackageOutputPath>$(MSBuildThisFileDirectory)..\artifacts</PackageOutputPath>
<version>1.4.17</version>
<version>1.4.22</version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Primitively.Abstractions/DependencyInjection.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Primitively.Configuration;

#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace Microsoft.Extensions.DependencyInjection;
#pragma warning restore IDE0130 // Namespace does not match folder structure

/// <summary>
/// This static class provides extension methods for the <see cref="IServiceCollection"/> to add Primitively services.
Expand Down
6 changes: 2 additions & 4 deletions src/Primitively.Abstractions/Primitively.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
<Import Project="..\Publish.props" />

<ItemGroup>
<PackageReference Include="IsExternalInit" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="IsExternalInit" Version="1.0.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/Primitively.AspNetCore.Mvc/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using Primitively.AspNetCore.Mvc.ModelBinding;
using Primitively.Configuration;

#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace Microsoft.Extensions.DependencyInjection;
#pragma warning restore IDE0130 // Namespace does not match folder structure

/// <summary>
/// This static class provides extension methods to the <see cref="PrimitivelyConfigurator"/> for adding ASP.NET MVC services.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Description>A library which provides ASP.NET Core MVC support for types produced by the Primitively C# source generator</Description>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>$(WarningsNotAsErrors);NU1903;</WarningsNotAsErrors>
</PropertyGroup>

<Import Project="..\Publish.props" />

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.AspNetCore.Mvc.ApiExplorer" Version="2.2.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
Expand Down
2 changes: 2 additions & 0 deletions src/Primitively.AspNetCore.SwaggerGen/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using Primitively.Configuration;
using Swashbuckle.AspNetCore.SwaggerGen;

#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace Microsoft.Extensions.DependencyInjection;
#pragma warning restore IDE0130 // Namespace does not match folder structure

/// <summary>
/// This static class provides extension methods to the <see cref="PrimitivelyConfigurator"/> for adding SwaggerGen services.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Description>A library which provides ASP.NET Core Open Api Schema support for types produced by the Primitively C# source generator</Description>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>$(WarningsNotAsErrors);NU1903;</WarningsNotAsErrors>
</PropertyGroup>

<Import Project="..\Publish.props" />

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/Primitively.AspNetCore/Primitively.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Description>A library which provides ASP.NET Core Model Binding and Open Api Schema support for types produced by the Primitively C# source generator</Description>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>$(WarningsNotAsErrors);NU1903;</WarningsNotAsErrors>
</PropertyGroup>

<Import Project="..\Publish.props" />

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
Expand Down
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>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Description>A library which provides FluentValidation support for types produced by the Primitively C# source generator</Description>
Expand All @@ -11,7 +11,7 @@
<Import Project="..\Publish.props" />

<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="FluentValidation" Version="11.9.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Primitively.MongoDB.Bson/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using Primitively.MongoDB.Bson;
using Primitively.MongoDB.Bson.Serialization;

#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace Microsoft.Extensions.DependencyInjection;
#pragma warning restore IDE0130 // Namespace does not match folder structure

/// <summary>
/// This static class provides extension methods to the <see cref="PrimitivelyConfigurator"/> for adding BSON services.
Expand Down
14 changes: 7 additions & 7 deletions src/Primitively.MongoDB.Bson/Primitively.MongoDB.Bson.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>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Description>A library which provides MongoDB support for types produced by the Primitively C# source generator</Description>
Expand All @@ -13,11 +13,11 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="MongoDB.Bson" Version="2.24.0" />
<PackageReference Include="IsExternalInit" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MongoDB.Bson" Version="2.27.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="IsExternalInit" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading