@@ -17,6 +17,7 @@ The purpose of SQLiteSharp is to provide improvements to the original library, w
1717
1818## Example
1919
20+ First, declare your object with optional annotations:
2021``` cs
2122public class ShopItem {
2223 [PrimaryKey , AutoIncrement ]
@@ -32,6 +33,7 @@ public class ShopItem {
3233}
3334```
3435
36+ Second, open a connection to your database:
3537``` cs
3638// Open a database connection
3739using SQLiteConnection Connection = new ("database .db ");
@@ -62,4 +64,43 @@ Connection.Delete(Apple);
6264// Find several items in the table
6365List < ShopItem > Bananas = Connection .Table <ShopItem >().Where (ShopItem => ShopItem .ItemName == " Banana" ).ToList ();
6466Assert .Single (Bananas );
65- ```
67+ ```
68+
69+ ## Custom Type Serialization
70+
71+ SQLiteSharp supports serialization for a set of common types, but custom types must be registered.
72+
73+ Type serialization is polymorphic, so you can register ` object ` as a fallback for all missing types.
74+
75+ ``` cs
76+ public class SweetWrapper {
77+ public Sweet ? Sweet { get ; set ; } // custom type
78+ }
79+ public class Sweet (string Flavour ) {
80+ public string ? Flavour { get ; set ; } = Flavour ;
81+ }
82+ ```
83+
84+ ``` cs
85+ // Open a database connection
86+ using SQLiteConnection Connection = new (":memory :");
87+
88+ // Register custom type
89+ Connection .Orm .RegisterType <Sweet >(
90+ SqliteType .Text ,
91+ serialize : (Sweet Sweet ) => JsonSerializer .Serialize (Sweet ),
92+ deserialize : (SqliteValue Value , Type ClrType ) => JsonSerializer .Deserialize (Value .AsText , ClrType )
93+ );
94+ ```
95+
96+ ## Versioning Guide
97+
98+ SQLiteSharp uses versions like "1.0" and "2.4".
99+
100+ #### For developers:
101+ - Increment the major version when adding new features or making breaking changes.
102+ - Increment the minor version when fixing bugs or making small improvements.
103+
104+ #### For users:
105+ - You usually want the latest major version, although it may require some changes to your project.
106+ - You always want the latest minor version, and there should not be any issues upgrading.
0 commit comments