联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Database作业Database作业

日期:2020-11-03 11:18

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 ());

COMPSCI 335 2 A#2.4

Pretty printed result:

[

{"ArtistId":150,"Name":"U2"},

{"ArtistId":70,"Name":"Toquinho \u0026 Vin\u00EDcius"},

{"ArtistId":200,"Name":"The Posies"}

]

Submission: to automarker, one single C# source file, containing your code and the

chinook EF scaffold (cf. the skeleton)

Additional packages:

o Microsoft.EntityFrameworkCore.Sqlite

o System.Linq.Dynamic.Core

Skelton folder contains:

o a C# project file, including the additional packages

o a C# source file, including the scaffold

o a copy of chinook.db

o sample requests and responses

o bat and sh script files

Tables: ….

Dynamic LINQ functions: Select, Where, OrderBy, Skip, Take


版权所有:留学生编程辅导网 2018 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。