SierraLib.API.Views
1.0.1
See the version list below for details.
dotnet add package SierraLib.API.Views --version 1.0.1
NuGet\Install-Package SierraLib.API.Views -Version 1.0.1
<PackageReference Include="SierraLib.API.Views" Version="1.0.1" />
paket add SierraLib.API.Views --version 1.0.1
#r "nuget: SierraLib.API.Views, 1.0.1"
// Install SierraLib.API.Views as a Cake Addin #addin nuget:?package=SierraLib.API.Views&version=1.0.1 // Install SierraLib.API.Views as a Cake Tool #tool nuget:?package=SierraLib.API.Views&version=1.0.1
SierraLib.API.Views
A pattern for versioned views into your data model for APIs
This library provides a pair of interfaces and some extension methods which act as a framework on which you can build and maintain multiple, versioned, views into your core data models. It has been designed to work in concert with good API design patterns like versioned endpoints and semantic versioning to simplify the development of backwards compatible API surfaces as your services evolve.
Example
namespace Example
{
using SierraLib.API.Views;
public class UserProfile
{
public Guid Id { get; set; }
public string Fullname { get; set; }
public DateTime DateOfBirth { get; set; }
public class Version1 : IView<UserProfile>
{
public string Id { get; set; }
public string Fullname { get; set; }
public DateTime DateOfBirth { get; set; }
public class Representer : IRepresenter<UserProfile, Version1>
{
public UserProfile ToModel(Version1 view)
{
return new UserProfile
{
Id = view.Id is null ? Guid.NewGuid() : Guid.ParseExact(view.Id, "N"),
Fullname = view.Fullname,
DateOfBirth = view.DateOfBirth,
};
}
public Version1 ToView(UserProfile model)
{
return new Version1
{
Id = model.Id.ToString("N"),
Fullname = model.Fullname,
DateOfBirth = model.DateOfBirth,
};
}
}
}
}
}
Interfaces
IView<TModel>
The IView
interface is used to mark classes which represent a view into a specific model.
IRepresenter<TModel, TView>
The IRepresenter
interface provides the ToModel
and ToView
methods and is responsible for
working to convert between the TModel
and the TView
.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.FxCopAnalyzers (>= 2.9.4)
- Microsoft.Extensions.DependencyInjection (>= 2.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.0.137 | 439 | 3/18/2024 | |
1.0.8 | 1,653 | 8/19/2021 | |
1.0.6 | 306 | 8/18/2021 | |
1.0.5 | 300 | 8/18/2021 | |
1.0.4 | 321 | 8/18/2021 | |
1.0.4-alpha.0.12 | 192 | 7/14/2021 | |
1.0.4-alpha.0.11 | 193 | 7/14/2021 | |
1.0.4-alpha.0.10 | 196 | 7/14/2021 | |
1.0.4-alpha.0.7 | 228 | 3/25/2021 | |
1.0.4-alpha.0.6 | 243 | 3/15/2021 | |
1.0.4-alpha.0.5 | 261 | 2/24/2021 | |
1.0.4-alpha.0.4 | 218 | 2/1/2021 | |
1.0.4-alpha.0.3 | 281 | 1/8/2021 | |
1.0.4-alpha.0.2 | 235 | 12/23/2020 | |
1.0.4-alpha.0.1 | 251 | 12/9/2020 | |
1.0.3 | 679 | 12/4/2020 | |
1.0.3-alpha.0.8 | 249 | 12/4/2020 | |
1.0.3-alpha.0.7 | 249 | 12/4/2020 | |
1.0.3-alpha.0.6 | 248 | 12/3/2020 | |
1.0.3-alpha.0.5 | 281 | 11/9/2020 | |
1.0.3-alpha.0.4 | 267 | 10/29/2020 | |
1.0.3-alpha.0.3 | 278 | 10/14/2020 | |
1.0.3-alpha.0.2 | 305 | 10/13/2020 | |
1.0.3-alpha.0.1 | 269 | 9/28/2020 | |
1.0.2 | 524 | 9/28/2020 | |
1.0.2-alpha.0.9 | 290 | 9/28/2020 | |
1.0.2-alpha.0.8 | 296 | 9/28/2020 | |
1.0.2-alpha.0.7 | 293 | 9/28/2020 | |
1.0.2-alpha.0.6 | 292 | 9/28/2020 | |
1.0.2-alpha.0.5 | 292 | 9/28/2020 | |
1.0.2-alpha.0.4 | 292 | 9/28/2020 | |
1.0.2-alpha.0.3 | 342 | 6/14/2020 | |
1.0.2-alpha.0.2 | 319 | 9/28/2019 | |
1.0.1 | 752 | 9/28/2019 |