项目作者: ctemelkuran

项目描述 :
Database Management System Project for the DBMS course.
高级语言: C#
项目地址: git://github.com/ctemelkuran/MovieTownDBMS.git
创建时间: 2021-06-20T18:14:15Z
项目社区:https://github.com/ctemelkuran/MovieTownDBMS

开源协议:

下载


Movie Town Database Management System Project

Developed in .NET Framework 4.8, using SQL Server and Dapper NuGet.

Why Dapper?

Because it is “King of Micro ORM” in terms of speed and performance. Also, it is developed by Stack Overflow developers and doesn’t going anywhere any time soon.
Implementation is relatively simple than Entity Framework and ADO.NET for a small project. It can work after three-step process:

  • Create an IDbConnection object.
  • Write a query to perform CRUD operations.
  • Pass query as a parameter in the Execute method.

Queries can be called using stored procedures. Stored procedures are stored in the database and they save time and memory.
Also, provides some level of protection for SQL injection. More information available on https://dapper-tutorial.net/. And I would like to thank Tim Corey for his wonderful tutorials about database, Dapper and C# in general.

  1. public List<Movie> GetMovie(string title)
  2. {
  3. using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("MovieDatabaseDB")))
  4. {
  5. var movieList = connection.Query<Movie>("Movie_ViewAllOrSearchByTitle @Title",
  6. new { Title = title }).ToList();
  7. return movieList;
  8. }
  9. }

SQL queries can also executed with connection.Execute(SQLQuery) after connection is established.
In this code block Dapper’s Query method is used to select id. And Execute method is used to insert selected values.

  1. string selectMovieId = "SELECT Id FROM Movies WHERE Title = '" + movieTitle + "';";
  2. var selectedMovieId = connection.Query<Movie>(selectMovieId).FirstOrDefault();
  3. string insertToMovieGenres = "INSERT INTO MovieGenres(MovieId, GenreId) VALUES ( "
  4. + selectedMovieId.Id + "," + genreId + ");";
  5. connection.Execute(insertToMovieGenres);

Movie Town Interface

Home
ui

Schema Diagram

![er-diagram][schema]

[schema]:images/Schema Diagram Movie Town.png “schema”