diff --git a/CliFx.Demo/CliFx.Demo.csproj b/CliFx.Demo/CliFx.Demo.csproj
index bcd69f3..ad30973 100644
--- a/CliFx.Demo/CliFx.Demo.csproj
+++ b/CliFx.Demo/CliFx.Demo.csproj
@@ -7,7 +7,6 @@
-
diff --git a/CliFx.Demo/Domain/Book.cs b/CliFx.Demo/Domain/Book.cs
index 24266bc..47e23f1 100644
--- a/CliFx.Demo/Domain/Book.cs
+++ b/CliFx.Demo/Domain/Book.cs
@@ -2,21 +2,4 @@
namespace CliFx.Demo.Domain;
-public class Book
-{
- public string Title { get; }
-
- public string Author { get; }
-
- public DateTimeOffset Published { get; }
-
- public Isbn Isbn { get; }
-
- public Book(string title, string author, DateTimeOffset published, Isbn isbn)
- {
- Title = title;
- Author = author;
- Published = published;
- Isbn = isbn;
- }
-}
\ No newline at end of file
+public record Book(string Title, string Author, DateTimeOffset Published, Isbn Isbn);
\ No newline at end of file
diff --git a/CliFx.Demo/Domain/Isbn.cs b/CliFx.Demo/Domain/Isbn.cs
index 8fdbdfb..ff2f0fc 100644
--- a/CliFx.Demo/Domain/Isbn.cs
+++ b/CliFx.Demo/Domain/Isbn.cs
@@ -2,32 +2,13 @@
namespace CliFx.Demo.Domain;
-public partial class Isbn
+public partial record Isbn(int EanPrefix, int RegistrationGroup, int Registrant, int Publication, int CheckDigit)
{
- public int EanPrefix { get; }
-
- public int RegistrationGroup { get; }
-
- public int Registrant { get; }
-
- public int Publication { get; }
-
- public int CheckDigit { get; }
-
- public Isbn(int eanPrefix, int registrationGroup, int registrant, int publication, int checkDigit)
- {
- EanPrefix = eanPrefix;
- RegistrationGroup = registrationGroup;
- Registrant = registrant;
- Publication = publication;
- CheckDigit = checkDigit;
- }
-
public override string ToString() =>
$"{EanPrefix:000}-{RegistrationGroup:00}-{Registrant:00000}-{Publication:00}-{CheckDigit:0}";
}
-public partial class Isbn
+public partial record Isbn
{
public static Isbn Parse(string value, IFormatProvider formatProvider)
{
diff --git a/CliFx.Demo/Domain/Library.cs b/CliFx.Demo/Domain/Library.cs
index 96137a9..8032e5d 100644
--- a/CliFx.Demo/Domain/Library.cs
+++ b/CliFx.Demo/Domain/Library.cs
@@ -4,15 +4,8 @@ using System.Linq;
namespace CliFx.Demo.Domain;
-public partial class Library
+public partial record Library(IReadOnlyList Books)
{
- public IReadOnlyList Books { get; }
-
- public Library(IReadOnlyList books)
- {
- Books = books;
- }
-
public Library WithBook(Book book)
{
var books = Books.ToList();
@@ -29,7 +22,7 @@ public partial class Library
}
}
-public partial class Library
+public partial record Library
{
public static Library Empty { get; } = new(Array.Empty());
}
\ No newline at end of file
diff --git a/CliFx.Demo/Domain/LibraryProvider.cs b/CliFx.Demo/Domain/LibraryProvider.cs
index 3ebc04c..478c368 100644
--- a/CliFx.Demo/Domain/LibraryProvider.cs
+++ b/CliFx.Demo/Domain/LibraryProvider.cs
@@ -1,6 +1,6 @@
using System.IO;
using System.Linq;
-using Newtonsoft.Json;
+using System.Text.Json;
namespace CliFx.Demo.Domain;
@@ -10,7 +10,7 @@ public class LibraryProvider
private void StoreLibrary(Library library)
{
- var data = JsonConvert.SerializeObject(library);
+ var data = JsonSerializer.Serialize(library);
File.WriteAllText(StorageFilePath, data);
}
@@ -21,7 +21,7 @@ public class LibraryProvider
var data = File.ReadAllText(StorageFilePath);
- return JsonConvert.DeserializeObject(data) ?? Library.Empty;
+ return JsonSerializer.Deserialize(data) ?? Library.Empty;
}
public Book? TryGetBook(string title) => GetLibrary().Books.FirstOrDefault(b => b.Title == title);
diff --git a/Readme.md b/Readme.md
index feaaf1a..3917e98 100644
--- a/Readme.md
+++ b/Readme.md
@@ -23,7 +23,7 @@ By using this project or its source code, for any purpose and in any shape or fo
- You **support Ukraine's territorial integrity, including its claims over temporarily occupied territories of Crimea and Donbas**
- You **reject false narratives perpetuated by Russian state propaganda**
-To learn more about the war and how you can help, [click here](https://tyrrrz.me). Glory to Ukraine! 🇺🇦
+To learn more about the war and how you can help, [click here](https://tyrrrz.me/ukraine). Glory to Ukraine! 🇺🇦
## Install