SierraLib.API.Views 1.0.1

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SierraLib.API.Views" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SierraLib.API.Views" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="SierraLib.API.Views" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SierraLib.API.Views --version 1.0.1
                    
#r "nuget: SierraLib.API.Views, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SierraLib.API.Views&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=SierraLib.API.Views&version=1.0.1
                    
Install as a Cake Tool

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 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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 861 3/18/2024
1.0.8 1,989 8/19/2021
1.0.6 353 8/18/2021
1.0.5 346 8/18/2021
1.0.4 366 8/18/2021
1.0.4-alpha.0.12 275 7/14/2021 1.0.4-alpha.0.12 is deprecated because it is no longer maintained.
1.0.4-alpha.0.11 277 7/14/2021 1.0.4-alpha.0.11 is deprecated because it is no longer maintained.
1.0.4-alpha.0.10 279 7/14/2021 1.0.4-alpha.0.10 is deprecated because it is no longer maintained.
1.0.4-alpha.0.7 319 3/25/2021 1.0.4-alpha.0.7 is deprecated because it is no longer maintained.
1.0.4-alpha.0.6 334 3/15/2021 1.0.4-alpha.0.6 is deprecated because it is no longer maintained.
1.0.4-alpha.0.5 354 2/24/2021 1.0.4-alpha.0.5 is deprecated because it is no longer maintained.
1.0.4-alpha.0.4 311 2/1/2021 1.0.4-alpha.0.4 is deprecated because it is no longer maintained.
1.0.4-alpha.0.3 377 1/8/2021 1.0.4-alpha.0.3 is deprecated because it is no longer maintained.
1.0.4-alpha.0.2 330 12/23/2020 1.0.4-alpha.0.2 is deprecated because it is no longer maintained.
1.0.4-alpha.0.1 346 12/9/2020 1.0.4-alpha.0.1 is deprecated because it is no longer maintained.
1.0.3 738 12/4/2020
1.0.3-alpha.0.8 347 12/4/2020 1.0.3-alpha.0.8 is deprecated because it is no longer maintained.
1.0.3-alpha.0.7 345 12/4/2020 1.0.3-alpha.0.7 is deprecated because it is no longer maintained.
1.0.3-alpha.0.6 343 12/3/2020 1.0.3-alpha.0.6 is deprecated because it is no longer maintained.
1.0.3-alpha.0.5 377 11/9/2020 1.0.3-alpha.0.5 is deprecated because it is no longer maintained.
1.0.3-alpha.0.4 365 10/29/2020 1.0.3-alpha.0.4 is deprecated because it is no longer maintained.
1.0.3-alpha.0.3 376 10/14/2020 1.0.3-alpha.0.3 is deprecated because it is no longer maintained.
1.0.3-alpha.0.2 402 10/13/2020 1.0.3-alpha.0.2 is deprecated because it is no longer maintained.
1.0.3-alpha.0.1 367 9/28/2020 1.0.3-alpha.0.1 is deprecated because it is no longer maintained.
1.0.2 579 9/28/2020
1.0.2-alpha.0.9 387 9/28/2020 1.0.2-alpha.0.9 is deprecated because it is no longer maintained.
1.0.2-alpha.0.8 390 9/28/2020 1.0.2-alpha.0.8 is deprecated because it is no longer maintained.
1.0.2-alpha.0.7 388 9/28/2020 1.0.2-alpha.0.7 is deprecated because it is no longer maintained.
1.0.2-alpha.0.6 393 9/28/2020 1.0.2-alpha.0.6 is deprecated because it is no longer maintained.
1.0.2-alpha.0.5 387 9/28/2020 1.0.2-alpha.0.5 is deprecated because it is no longer maintained.
1.0.2-alpha.0.4 389 9/28/2020 1.0.2-alpha.0.4 is deprecated because it is no longer maintained.
1.0.2-alpha.0.3 440 6/14/2020 1.0.2-alpha.0.3 is deprecated because it is no longer maintained.
1.0.2-alpha.0.2 428 9/28/2019 1.0.2-alpha.0.2 is deprecated because it is no longer maintained.
1.0.1 825 9/28/2019