C#代写 | COMPSCI 335 1 A#2.4 Assignment #2.4 – Chinook

这个作业是用C#完成SQLite的查询,并用json展示
COMPSCI 335 1 A#2.4
Assignment #2.4 – Chinook

Run a fluent dynamic query on the Chinook.db SQLite database.
The query comes from stdin, in the following format (sample):
Artists
OrderBy Name DESC
Where ArtistId % 10 == 0
Take 3
Select new (ArtistId, Name)
The first line contains the starting table.
Each of the next line contains the name of a LINQ operator, followed by a lambda given
in the string format expected by dynamic LINQ.
The project will translate the above input into the following dynamic LINQ code:
var seq2 = db.Artists
.OrderBy (“Name DESC”)
.Where (“ArtistId % 10 == 0”)
.Take (3)
.Select (“new (ArtistId, Name)”);
FYI, this corresponds to the following standard LINQ code:
var seq2 = db.Artists
.OrderByDescending (id => Name)
.Where (id => id.ArtistId % 10 == 0)
.Take (3)
.Select (id => new {id.ArtistId, id.Name};
The dynamic LINQ result, which here is a dynamic queryable sequence, will be further
transformed and printed to stdout in JSON format:
var res = JsonSerializer.Serialize (seq2 .AsEnumerable () .ToList ());