# using Dapper DB Multimapping Step 1 is done already you must proceed to step 2 See attached photo for the problem and instructions. All the instructions are there already
# using Dapper DB Multimapping Step 1 is done already you must proceed to step 2 See attached photo for the problem and instructions. All the instructions are there already
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
C# using Dapper DB Multimapping
Step 1 is done already you must proceed to step 2
See attached photo for the problem and instructions. All the instructions are there already
![STEP
1: DONE
1. Run SchoolDb.sql to your local database. It will create an Exer 3Db database with a School
Department Table.
College
Department
Id
Id
Name
Name
Address
Dean
Chair
Motto
Theme
Collegeld
Average Tuition
Schoolld
15
16
/*** Drop Table ***/
17 DROP TABLE IF EXISTS [dbo]. [School]
18
GO
/*** Drop Table ***/
19
DROP TABLE IF EXISTS [dbo].[College]
21
GO
22
/*** Drop Table ***/
23 DROP TABLE IF EXISTS [dbo]. [Department]
24
GO
25
26
/*** Create school table ***/
27 CREATE TABLE [dbo]. [School]
28
29
[ID] INT NOT NULL PRIMARY KEY IDENTITY(1,1),
30
[Name] NVARCHAR(50) NOT NULL,
31
[Address] NVARCHAR(50) NOT NULL,
32
[Motto] NVARCHAR(50) NOT NULL,
33
[Average Tuition] DECIMAL (18,2) NOT NULL
34
35
STEP 2: YOU MUST ADD/CREATE THE MODELS AND PROPERTIES
2. Add/create necessary models and properties for School, College, and Department models.
internal class School
F
{
// TODO: Fill with properties
/// <summary>
Add properties
/// Prints this object as JSON
/// </summary>
/// <returns>json string representation of this object</returns>
O references
public override string ToString()
{
return JsonConvert. SerializeObject(this);
STEP 3: Implement the functions below ASYNCHRONOUSLY
3. Implement ISchool Repository ASYNCHRONOUSLY.
o Get (id) - Returns single school with Id == id
o GetAll() - Returns all schools
o These methods should only use ONE sql statement and Query each call. NO MULTIPLE QUERY CALLS.
o Should utilize Dapper multimapping capabilities.
internal class School Repository : ISchool Repository
{
private DapperContext context;
O references
public School Repository ()
IMPLEMENT THIS ONE
_context = new DapperContext("Data Source=(localdb)\\P
public Task<IEnumerable<School>> GetAllSchools()
School
Id
Name
{
}
1 reference
{
}
throw new Not Implemented Exception();
1 reference
public Task<School> GetSchool(int id)
{
throw new Not Implemented Exception();
College, and
THIS
IS JUST A REFERENCE YOU CAN IGNORE THIS BUT
THIS ONE MIGHT HELP YOU SOLVING THE PROBLEM
Model format when printed in console
[
}
"Id": 1,
"Name" : "SchoolName1",
"Address" : "SchoolAddress1",
"Motto": "SchoolMotto1",
"AverageTuition": 1,
"Colleges" : [
{
]
}
"Id": 1,
"Name" : "CollegeName1",
"Dean" : "CollegeDean1",
"Theme" : "College Theme1",
"Departments":[
{
]
},
{
}
//
"Id": 1,
"Name": "DepartmentName1",
"Chair": "DepartmentChair1"
more schools
"Id": 2,
"Name": "DepartmentName2",
"Chair": "DepartmentChair2"
more departments under this collegel
more colleges under this school1](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F97b95a29-5342-40e6-ae85-07ce790f9220%2Fd5a7da38-a0b2-4d7c-9fbe-a30ab3af572a%2F9cf312e_processed.png&w=3840&q=75)
Transcribed Image Text:STEP
1: DONE
1. Run SchoolDb.sql to your local database. It will create an Exer 3Db database with a School
Department Table.
College
Department
Id
Id
Name
Name
Address
Dean
Chair
Motto
Theme
Collegeld
Average Tuition
Schoolld
15
16
/*** Drop Table ***/
17 DROP TABLE IF EXISTS [dbo]. [School]
18
GO
/*** Drop Table ***/
19
DROP TABLE IF EXISTS [dbo].[College]
21
GO
22
/*** Drop Table ***/
23 DROP TABLE IF EXISTS [dbo]. [Department]
24
GO
25
26
/*** Create school table ***/
27 CREATE TABLE [dbo]. [School]
28
29
[ID] INT NOT NULL PRIMARY KEY IDENTITY(1,1),
30
[Name] NVARCHAR(50) NOT NULL,
31
[Address] NVARCHAR(50) NOT NULL,
32
[Motto] NVARCHAR(50) NOT NULL,
33
[Average Tuition] DECIMAL (18,2) NOT NULL
34
35
STEP 2: YOU MUST ADD/CREATE THE MODELS AND PROPERTIES
2. Add/create necessary models and properties for School, College, and Department models.
internal class School
F
{
// TODO: Fill with properties
/// <summary>
Add properties
/// Prints this object as JSON
/// </summary>
/// <returns>json string representation of this object</returns>
O references
public override string ToString()
{
return JsonConvert. SerializeObject(this);
STEP 3: Implement the functions below ASYNCHRONOUSLY
3. Implement ISchool Repository ASYNCHRONOUSLY.
o Get (id) - Returns single school with Id == id
o GetAll() - Returns all schools
o These methods should only use ONE sql statement and Query each call. NO MULTIPLE QUERY CALLS.
o Should utilize Dapper multimapping capabilities.
internal class School Repository : ISchool Repository
{
private DapperContext context;
O references
public School Repository ()
IMPLEMENT THIS ONE
_context = new DapperContext("Data Source=(localdb)\\P
public Task<IEnumerable<School>> GetAllSchools()
School
Id
Name
{
}
1 reference
{
}
throw new Not Implemented Exception();
1 reference
public Task<School> GetSchool(int id)
{
throw new Not Implemented Exception();
College, and
THIS
IS JUST A REFERENCE YOU CAN IGNORE THIS BUT
THIS ONE MIGHT HELP YOU SOLVING THE PROBLEM
Model format when printed in console
[
}
"Id": 1,
"Name" : "SchoolName1",
"Address" : "SchoolAddress1",
"Motto": "SchoolMotto1",
"AverageTuition": 1,
"Colleges" : [
{
]
}
"Id": 1,
"Name" : "CollegeName1",
"Dean" : "CollegeDean1",
"Theme" : "College Theme1",
"Departments":[
{
]
},
{
}
//
"Id": 1,
"Name": "DepartmentName1",
"Chair": "DepartmentChair1"
more schools
"Id": 2,
"Name": "DepartmentName2",
"Chair": "DepartmentChair2"
more departments under this collegel
more colleges under this school1
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education