Mecesoft.ShortGuid 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mecesoft.ShortGuid --version 1.0.1
                    
NuGet\Install-Package Mecesoft.ShortGuid -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="Mecesoft.ShortGuid" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mecesoft.ShortGuid" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Mecesoft.ShortGuid" />
                    
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 Mecesoft.ShortGuid --version 1.0.1
                    
#r "nuget: Mecesoft.ShortGuid, 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.
#:package Mecesoft.ShortGuid@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mecesoft.ShortGuid&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Mecesoft.ShortGuid&version=1.0.1
                    
Install as a Cake Tool

Mecesoft.ShortGuid

Kısa, URL‑güvenli, padding’siz Base64 temsiline sahip Guid sarmalayıcısı (ShortGuid) ve .NET/EF Core entegrasyonları.

Özellikler

  • 22 karakterlik ShortGuid (Base64 URL‑safe, '=' padding yok; '+' → '-', '/' → '_').
  • System.Text.Json için gömülü JsonConverter (atribüt ile).
  • Binding senaryoları için TypeConverter.
  • EF Core için ValueConverter ve model geneli için kolay uzantı (UseShortGuidConverters).
  • net9.0 hedefi, Nullable ve ImplicitUsings etkin.

Kurulum

  • Projeyi referans alın veya NuGet paketini oluşturup yayınlayın.
  • NuGet package ID: Mecesoft.ShortGuid (paketi yerel olarak dotnet pack ile üretebilirsiniz).

Hızlı Başlangıç

  1. ShortGuid oluşturma ve yazdırma
using Mecesoft.ShortGuid;

var sg = ShortGuid.NewGuid();
string s = sg.ToString(); // 22 karakter
ShortGuid parsed = ShortGuid.Parse(s); // round‑trip
Guid g = sg;                 // implicit cast ShortGuid -> Guid
ShortGuid sg2 = (ShortGuid)g; // implicit cast Guid -> ShortGuid
  1. System.Text.Json ile kullanım (atribüt zaten tanımlı)
using System.Text.Json;
using Mecesoft.ShortGuid;

var sg = ShortGuid.NewGuid();
var json = JsonSerializer.Serialize(new { id = sg });
var obj = JsonSerializer.Deserialize<Wrapper>(json);

public record Wrapper(ShortGuid id);
  1. EF Core modeli genelinde dönüştürücü uygulama
using Mecesoft.ShortGuid.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

public class AppDbContext : DbContext
{
    public DbSet<User> Users => Set<User>();

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.UseShortGuidConverters(); // ShortGuid <-> Guid converter tüm ShortGuid alanlarına uygulanır
    }
}

public class User
{
    public ShortGuid Id { get; set; }
}

ShortGuid biçimi

  • 16 baytlık Guid verisi Base64’e çevrilir, ardından URL‑güvenli hâle getirilir ve sondaki "==" kaldırılır.
  • Örnek: 5Qqz8l5wQ0mY1m6dH7e5xQ (uzunluk 22).
  • Parse/TryParse hem normal Guid string’i hem de 22 karakterlik ShortGuid’i kabul eder.

Derleme ve Paketleme

  • Gereksinimler: .NET SDK 9.x, internet erişimi (EF Core 9 bağımlılığı için).
  • Derle: dotnet build Mecesoft.ShortGuid/Mecesoft.ShortGuid.csproj -c Release
  • Paketle: dotnet pack Mecesoft.ShortGuid/Mecesoft.ShortGuid.csproj -c Release
    • Proje GeneratePackageOnBuild=true ayarlı olduğundan dotnet build de .nupkg üretir.

Lisans

  • MIT License (bkz. LICENSE).
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
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.5 197 9/14/2025
1.0.4 113 9/13/2025
1.0.3 120 9/13/2025
1.0.2 120 9/13/2025
1.0.1 117 9/13/2025
1.0.0 113 9/13/2025