Guint 2.0.0
See the version list below for details.
dotnet add package Guint --version 2.0.0
NuGet\Install-Package Guint -Version 2.0.0
<PackageReference Include="Guint" Version="2.0.0" />
paket add Guint --version 2.0.0
#r "nuget: Guint, 2.0.0"
// Install Guint as a Cake Addin #addin nuget:?package=Guint&version=2.0.0 // Install Guint as a Cake Tool #tool nuget:?package=Guint&version=2.0.0
Guint
Sure! int
's make pretty primary keys! They're fast! Easy to share! Easy to communicate!
Yes, but...
- Now I can enumerate your primary keys. One little authorization oversight and all your data are belong to me, thank you
- And, ha! all your competitors and future investors can exactly see how many records you actually have, thanks again!
- And, no proper domain-centric architecture or CQS for you, my friend, with your database dictating id's. Back to 2005 🦕 do not collect $200 👋
So what should I do?
Change the primary key to Guid
But I can't!*
Then, use Guint
Take your int
and transform it to an Guid
and the other way around. So have your int
as a primary key in your database, but expose it as a Guid
In other words: Have your cake and eat it too!
Show me how
public async Task<IHttpActionResult> Get(Guid id)
=> id
.ToInt()
.Match(
i => this.carService.Get(i),
notfound => NotFound());
}
Setup
Generate your personal secret. Go to https://dotnetfiddle.net/2x6cA6 or run
var secret = Guint.GenerateSecret();
Initialize Guint at the start of your application with
Guint.Use(secret)
To transform, use extension methods
.ToGuid
,.ToInt
,.ToIntOrDefault
or.ToGuidOrExplode
* For reasons!
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. |
.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
- OneOf (>= 3.0.263)
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 |
---|---|---|
2.0.1 | 144 | 2/12/2024 |
2.0.0 | 207 | 2/9/2024 |
2.0.0-beta.5 | 63 | 2/9/2024 |
2.0.0-beta.4 | 84 | 2/8/2024 |
2.0.0-beta.3 | 56 | 2/8/2024 |
2.0.0-beta.2 | 65 | 2/6/2024 |
2.0.0-beta.1 | 61 | 2/2/2024 |
1.1.5 | 711 | 3/25/2022 |
1.1.4 | 439 | 3/25/2022 |
1.1.3 | 431 | 3/24/2022 |
1.1.2 | 435 | 2/17/2022 |
1.1.1 | 468 | 2/14/2022 |
1.1.0 | 463 | 1/24/2022 |
1.0.0 | 432 | 1/21/2022 |