kr.bbon.Core 1.2.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package kr.bbon.Core --version 1.2.4
NuGet\Install-Package kr.bbon.Core -Version 1.2.4
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="kr.bbon.Core" Version="1.2.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add kr.bbon.Core --version 1.2.4
#r "nuget: kr.bbon.Core, 1.2.4"
#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.
// Install kr.bbon.Core as a Cake Addin
#addin nuget:?package=kr.bbon.Core&version=1.2.4

// Install kr.bbon.Core as a Cake Tool
#tool nuget:?package=kr.bbon.Core&version=1.2.4

kr.bbon.Core Package

alternate text is missing from this package README image alternate text is missing from this package README image publish to nuget

πŸ“’ Overview

.NET 5 μ—μ„œ ν”„λ‘œμ νŠΈλ₯Ό μ‹œμž‘ν•  λ•Œ, 반볡적으둜 μž‘μ„±ν•˜λ˜ 사항을 νŒ¨ν‚€μ§€λ‘œ μ •λ¦¬ν–ˆμŠ΅λ‹ˆλ‹€.

🌈 Namespace

kr.bbon.Core λ„€μž„μŠ€νŽ˜μ΄μŠ€

κΈ°λ³Έ λ„€μž„μŠ€νŽ˜μ΄μŠ€λ‘œ kr.bbon.Core λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.

kr.bbon.Core.Converters λ„€μž„μŠ€νŽ˜μ΄μŠ€

κ°’ λ³€ν™˜μ„ μœ„ν•œ κΈ°λŠ₯을 μ œκ³΅ν•˜λŠ” λ„€μž„μŠ€νŽ˜μ΄μŠ€μž…λ‹ˆλ‹€.

🎯 Features

Exception classes

ApiException class

API μ˜ˆμ™Έλ₯Ό ν‘œν˜„ν•˜κΈ° μœ„ν•΄ μ‚¬μš©λ©λ‹ˆλ‹€.

public Task SomeFeatureAsync()
{
    if(NotValid){
        var model = new ErrorModel("It's invalid message");
        throw new ApiException(400, model);
    }
    // ...
}
HttpStatusException class

ApiException class λ₯Ό μ‚¬μš©ν•˜μ‹­μ‹œμ˜€.

HTTP μ˜ˆμ™Έλ₯Ό ν‘œν˜„ν•˜κΈ° μœ„ν•΄ μ‚¬μš©λ©λ‹ˆλ‹€.

// Exception handling in action method
try
{
    // ...
}
catch(HttpStatusException ex)
{
    return StatusCode(ex.StatusCode, ex.Message, ex.GetDetails());
}
catch(Exception ex)
{
    // ...
}
HttpStatusException<TDeatails> class

ApiException class λ₯Ό μ‚¬μš©ν•˜μ‹­μ‹œμ˜€.

HTTP μ˜ˆμ™Έμ™€ 상세 정보λ₯Ό ν‘œν˜„ν•˜κΈ° μœ„ν•΄ μ‚¬μš©λ©λ‹ˆλ‹€.

throw new HttpStatusException(HttpStatusCode.BadRequest, new SomeDetails
{
    Id = "err111",
    Message = "AAA μ†μ„±μ˜ 값이 μ •μˆ˜κ°€ μ•„λ‹™λ‹ˆλ‹€.",
});
SomethingWrongException

ApiException class λ₯Ό μ‚¬μš©ν•˜μ‹­μ‹œμ˜€.

μ‚¬μš©μž μ •μ˜ μ˜ˆμ™Έλ₯Ό ν‘œν˜„ν•˜κΈ° μœ„ν•΄ μ‚¬μš©ν•©λ‹ˆλ‹€.

// Exception handling in action method 
try
{
    // ...
}
catch(SomethingWrongException ex)
{
    return StatusCode(HttpStatusCode.Forbidden, ex.Message, ex.GetDetails());
}
catch(Exception ex)
{
    // ...
}
SomethingWrongException<TDetails>

ApiException class λ₯Ό μ‚¬μš©ν•˜μ‹­μ‹œμ˜€.

μ‚¬μš©μž μ •μ˜ μ˜ˆμ™Έμ™€ 상세 정보λ₯Ό ν‘œν˜„ν•˜κΈ° μœ„ν•΄ μ‚¬μš©ν•©λ‹ˆλ‹€.

throw new SomethingWrongException("데이터λ₯Ό μ²˜λ¦¬ν•˜μ§€ λͺ»ν–ˆμŠ΅λ‹ˆλ‹€.", new SomeDetails 
{
    Id = "err111",
    Message = "AAA μ†μ„±μ˜ 값이 μ •μˆ˜κ°€ μ•„λ‹™λ‹ˆλ‹€.",
});

Extension methods

Object.ToJson<T>() method

Object ν΄λž˜μŠ€μ— ToJson λ©”μ„œλ“œλ₯Ό μΆ”κ°€ν•©λ‹ˆλ‹€.

객체의 μΈμŠ€ν„΄μŠ€λ₯Ό JSON λ¬Έμžμ—΄λ‘œ μ§λ ¬ν™”ν•˜λŠ” κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€.

var sample = getSampleModel();
sample.ToJson();

JsonSerializerOptions λ§€κ°œλ³€μˆ˜κ°€ μ§€μ •λ˜μ§€ μ•Šμ€ 경우 μ•„λž˜ 기본값을 μ‚¬μš©ν•©λ‹ˆλ‹€.

var defaultOptions = new JsonSerializerOptions
{
    WriteIndented = true,
    Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
    PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};

kr.bbon.Core.Converters namespace

JavascriptDateConverter class
ToDateTimeOffset method

μžλ°”μŠ€ν¬λ¦½νŠΈ λ°€λ¦¬μ΄ˆ 값을 DateTimeOffset 으둜 λ³€ν™˜ν•©λ‹ˆλ‹€.

ToJavascriptDateMilliseconds method

DateTimeOffset 값을 μžλ°”μŠ€ν¬λ¦½νŠΈ λ°€λ¦¬μ΄ˆ κ°’μœΌλ‘œ λ³€ν™˜ν•©λ‹ˆλ‹€.

JavascriptDateConverter converter = new JavascriptDateConverter();
var javascriptDateValue = 1624165031491;
var datetimeOffsetValue = converter.ToDateTimeOffset(javascriptDateValue);
var milliseconds = converter.ToJavascriptDateMilliseconds(datetimeOffsetValue);

Assert.Equal(javascriptDateValue, milliseconds.Value);
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 is compatible. 
.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 (4)

Showing the top 4 NuGet packages that depend on kr.bbon.Core:

Package Downloads
kr.bbon.AspNetCore

Helper for ASP.NET Core

kr.bbon.EntityFrameworkCore.Extensions

Provider EntityFrameworkCore extensions.

kr.bbon.Data.Abstractions

kr.bbon.Data.Abstractions

kr.bbon.Services

Provides implementations of frequently used services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.7.0 242 1/3/2024
1.6.2 644 12/31/2022
1.6.1 555 11/22/2022
1.5.0 699 11/19/2022
1.4.10 364 11/10/2022
1.4.7 938 6/27/2022
1.4.6 1,033 5/3/2022
1.4.5 1,454 3/19/2022
1.4.3 830 1/22/2022
1.4.1 777 12/22/2021
1.4.0 1,454 12/7/2021
1.3.0 533 11/12/2021
1.2.5 356 10/11/2021
1.2.4 381 10/11/2021
1.2.3 554 9/27/2021
1.2.2 717 9/19/2021
1.2.1 416 9/19/2021
1.2.0 514 9/19/2021
1.1.0 455 6/20/2021
1.0.0 707 6/15/2021