Install SQLite-net from source
masterSQLite-net is contained in single files and can be added directly to your project:
- Add
SQLite.csfor the synchronous implementation. - Add
SQLiteAsync.csfor the asynchronous implementation.
repository·master·Indexed 26 days ago
https://github.com/praeclarum/sqlite-netA minimal, open-source library providing a lightweight ORM for .NET, .NET Core, and Mono applications to store data in SQLite 3 databases. It allows mapping classes to tables using attributes such as [PrimaryKey], [AutoIncrement], [Indexed], and [Ignore]. Available via the sqlite-net-pcl NuGet package or as single-file source implementations (SQLite.cs and SQLiteAsync.cs).
SQLite-net is contained in single files and can be added directly to your project:
SQLite.cs for the synchronous implementation.SQLiteAsync.cs for the asynchronous implementation.To use SQLite-net in your projects, install the sqlite-net-pcl package from NuGet.
Important: You must add the NuGet package to both your .NET Standard library project and your platform-dependent app project.
Use simple attributes to control how your classes are mapped to database tables:
[PrimaryKey]: Marks a property as the primary key.[AutoIncrement]: Enables auto-incrementing for the primary key.[Indexed]: Creates an index on the property.[Ignore]: Tells the ORM to ignore this property during database operations.```csharp
public class Stock
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Symbol { get; set; }
}
public class Valuation
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[Indexed]
public int StockId { get; set; }
public DateTime Time { get; set; }
public decimal Price { get; set; }
[Ignore]
public string IgnoreField { get; set; }
}
```埋