{"id":18572774,"url":"https://github.com/truecodersio/orm-and-dapper-exercise","last_synced_at":"2025-04-06T22:07:32.414Z","repository":{"id":62916231,"uuid":"533571464","full_name":"truecodersio/ORM-and-Dapper-Exercise","owner":"truecodersio","description":".NET 6.0 template project for the ORM and Dapper exercise at TrueCoders","archived":false,"fork":false,"pushed_at":"2025-03-28T16:44:58.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":292,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T19:08:22.158Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/truecodersio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-07T02:17:11.000Z","updated_at":"2025-03-28T16:45:03.000Z","dependencies_parsed_at":"2024-12-11T03:01:32.188Z","dependency_job_id":"89b039ba-c696-47cf-bd79-f0b6b4947aa0","html_url":"https://github.com/truecodersio/ORM-and-Dapper-Exercise","commit_stats":{"total_commits":5,"total_committers":3,"mean_commits":"1.6666666666666667","dds":0.6,"last_synced_commit":"7c105c41a4ea95f76f119ac3f5c84bd31012c752"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FORM-and-Dapper-Exercise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FORM-and-Dapper-Exercise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FORM-and-Dapper-Exercise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truecodersio%2FORM-and-Dapper-Exercise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/truecodersio","download_url":"https://codeload.github.com/truecodersio/ORM-and-Dapper-Exercise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557767,"owners_count":20958047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T23:07:11.829Z","updated_at":"2025-04-06T22:07:32.386Z","avatar_url":"https://github.com/truecodersio.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Exercise One\nTaking what we’ve learned in class, implement Dapper inside this application.\n\nWe’ll start with Departments:\n1. Ignore appsettings.json file in .gitignore and commit\n2. Create appsettings.json in netcoreapp folder\n3.Run a git status to make sure appsettings is ignored\n4. Add the MySql.Data Nuget Package\n5. Add the Dapper Nuget package\n6. Add the Microsoft.Extensions.Configuration.Json Nuget package\n7. Make sure your config code is in your main method\n\n```\nvar config = new ConfigurationBuilder()\n                .SetBasePath(Directory.GetCurrentDirectory())\n                .AddJsonFile(\"appsettings.json\")\n                .Build();\n\nstring connString = config.GetConnectionString(\"DefaultConnection\");\n\nIDbConnection conn = new MySqlConnection(connString);\n```\n\n8. Create a Department class\n9.Create an IDepartmentRepository interface\n10. Create a DapperDepartmentRepository class\n11. Create a GetAllDepartments Method\n12. Create an InsertDepartment Method\n\nOnce finished, save, commit, and push back to Github\n\n## Exercise Two\n\n1. Create a public Product Class - this class will contain public properties that represent each column in the Products table.\n```\n// For example:\npublic int ProductID { get; set; }\n```\n\n2. Create a IProductRepository Interface - this interface will have:\n   + A GetAllProducts() method:\n   ```\n       IEnumerable\u003cProduct\u003e GetAllProducts();\n   ```\n   + A CreateProduct(string name, double price, int categoryID) method:\n   ```\n   void CreateProduct(string name, double price, int categoryID);\n   ```\n3. Create a DapperProductRepository Class that conforms to the IProductRepository interface. Here we will define our Methods.\n\n4.Implement our new methods in the Main method of Program.cs\n\n## Bonus:\nCreate the UpdateProduct method in the DapperProductRepository class and implement in Program.cs\n\n## Extra Bonus:\nCreate the DeleteProduct method\nHINT: You will need to delete records from the Sales table and the Reviews table where that Product may be referenced. You can do this all in the DeleteProduct method you are creating\n\nFinished Version:\nhttps://github.com/mvdoyle/BestBuyBestPractices\n\n\n\n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruecodersio%2Form-and-dapper-exercise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruecodersio%2Form-and-dapper-exercise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruecodersio%2Form-and-dapper-exercise/lists"}