DEV Community 👩‍💻👨‍💻

windy
windy

Posted on • Updated on

Working with Google Cloud Storage for ASP.NET Core 6 Applications


I made a detailed video tutorial Working with Google Cloud Storage for ASP.NET Core 6 Applications, and article, where you will learn how to work with Google Cloud Storage for ASP.NET Core 6 Web applications. This is the real time demonstration of performing file based CRUD operations directly on to the Google Cloud Storage. You can follow along with this tutorial if you have a GCP account. It's free to sign up and you will get $300 Credit if you sign up with your credit card.

Contents of this tutorial include
Part 1 - GCP Setup

  • Introduction
  • Login to GCP
  • Create a Project
  • Crate a Bucket
  • Create a Service Account
  • Create & Download key for Service Account

Part 2 - Create and Set up ASP.NET Core 6 MVC with EF Core project

  • Create ASP.NET Core 6 MVC Razor Project in Visual Studio
  • Update appsettings.json
  • Create GCS Config Options class
  • Register GCS Config Options class in services
  • Add Nuget - Google.Cloud.Storage.V1

Part 3 - Implement Cloud Storage Service to work upload, delete and read files from GCP Cloud Storage

  • Create a Cloud Storage Service
  • Implement Upload File Async for Google Cloud Storage
  • Implement Delete File Async for Google Cloud Storage
  • Implement Get Signed Url Async for Google Cloud Storage
  • Register Cloud Storage Service as singleton

Part 4 - Implement MVC application to handle file uploads on GCP Cloud Storage

  • Add a model with IFormFile field
  • Add a Controller
  • Manage Nuget packages - Add NpgSQL, Remove MSSQL
  • UseNpgSql in Program.cs & Update Connection String
  • Add Migrations
  • Update Database
  • Update Shared Layout Navigation to show Animals menu
  • Styling Home Page with Animals Poster

Part 4.1 - Implement MVC for Create View with File Upload functionality to Cloud Storage

  • Create Razor View with File Upload
  • Update Controller to depend on Cloud Storage Service
  • Implement Create Action to invoke Upload File to Cloud Storage
  • Test a file upload & Verify in Cloud Storage Bucket

Part 4.2 - Implement MVC for Details View with Show file from Signed URL of a file in Cloud Storage

  • Details Razor View with Image rendered from Signed URL
  • Implement Details Action to get Signed URL from Cloud Storage
  • Edit Razor View with File Upload

Part 4.3 - Implement MVC for Edit View with File Delete & Upload (replace) functionality to Cloud Storage

  • Implement Edit Action to Replace file in Cloud Storage
  • Test Edit Animal & Verify replace file in Cloud Storage Bucket
  • Delete Razor View with Image rendered from Signed URL

Part 4.4 - Implement MVC for Delete View with File Delete functionality from Cloud Storage

  • Implement Delete Action to remove file in Cloud Storage Bucket
  • Verify Delete Animal removes file from Cloud Storage Bucket
  • Play with the file CRUD operations on GCP
  • Showing List of Animals along with Photos in Index Razor View
  • Implement Index Action to get list of Signed URLs from GCS

Top comments (0)

12 Gorgeous UI Components for Your Design Inspiration

12 Gorgeous UI components for your design inspiration: cards, text, buttons, checkboxes, icons, loaders and menus.