EntitySpaces.ORM.SQLite
2020.1.3
EntitySpaces in .NET Standard Mode for SQLite (single assembly install)
See the version list below for details.
Install-Package EntitySpaces.ORM.SQLite -Version 2020.1.3
dotnet add package EntitySpaces.ORM.SQLite --version 2020.1.3
<PackageReference Include="EntitySpaces.ORM.SQLite" Version="2020.1.3" />
paket add EntitySpaces.ORM.SQLite --version 2020.1.3
A Fluent SQL API
EntitySpaces is a Fluent API for SQL Server, SQLite, MySQL, PostgreSQL, and more on the way. If you are familiar with the SQL syntax then you are already an EntitySpaces expert. EntitySpaces is also high performance, transactional, and very intuitive. EntitySpaces Studio is used to generate your C# classes from your database schema.
Example Query
In this example we are going to sum the total # of items for each order. Each order can have many order detail records so we group our query by OrderId and sum up the quantity as 'TotalQuantity'. Notice that we can access the derived 'TotalQuantity' column through the dynamic property.
OrdersCollection coll = new OrdersQuery("o", out var o)
.InnerJoin<OrderDetailsQuery>("od", out var od).On(o.OrderID == od.OrderID)
.Select(o.OrderID, od.Quantity.Sum().As("TotalQuantity"))
.GroupBy(o.OrderID)
.OrderBy(o.OrderID.Ascending)
.ToCollection<OrdersCollection>();
foreach(Orders order in coll)
{
Console.WriteLine(order.OrderID + " : " + order.dynamic.TotalQuantity);
}
The SQL generated is just as you would expect.
SELECT o.[OrderID], SUM(od.[Quantity]) AS 'TotalQuantity'
FROM [Orders] o
INNER JOIN [Order Details] od ON o.[OrderID] = od.[OrderID]
GROUP BY o.[OrderID]
ORDER BY o.[OrderID] ASC
A Fluent SQL API
EntitySpaces is a Fluent API for SQL Server, SQLite, MySQL, PostgreSQL, and more on the way. If you are familiar with the SQL syntax then you are already an EntitySpaces expert. EntitySpaces is also high performance, transactional, and very intuitive. EntitySpaces Studio is used to generate your C# classes from your database schema.
Example Query
In this example we are going to sum the total # of items for each order. Each order can have many order detail records so we group our query by OrderId and sum up the quantity as 'TotalQuantity'. Notice that we can access the derived 'TotalQuantity' column through the dynamic property.
OrdersCollection coll = new OrdersQuery("o", out var o)
.InnerJoin<OrderDetailsQuery>("od", out var od).On(o.OrderID == od.OrderID)
.Select(o.OrderID, od.Quantity.Sum().As("TotalQuantity"))
.GroupBy(o.OrderID)
.OrderBy(o.OrderID.Ascending)
.ToCollection<OrdersCollection>();
foreach(Orders order in coll)
{
Console.WriteLine(order.OrderID + " : " + order.dynamic.TotalQuantity);
}
The SQL generated is just as you would expect.
SELECT o.[OrderID], SUM(od.[Quantity]) AS 'TotalQuantity'
FROM [Orders] o
INNER JOIN [Order Details] od ON o.[OrderID] = od.[OrderID]
GROUP BY o.[OrderID]
ORDER BY o.[OrderID] ASC
Release Notes
esEntity.dynamic tweak
Dependencies
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.5.0)
- System.Data.SQLite (>= 1.0.112)
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version History
Version | Downloads | Last updated |
---|---|---|
2020.1.15 | 217 | 1/15/2020 |
2020.1.3 | 137 | 1/3/2020 |
2019.12.20 | 141 | 12/20/2019 |
2019.12.19.1 | 152 | 12/18/2019 |
2019.12.18 | 139 | 12/18/2019 |