GithubHelp home page GithubHelp logo

3-tier-dotnet-mongodb-main's Introduction

3-Tier .NET & MongoDB Application

This project is a 3-tier web application built with .NET and MongoDB. The application consists of a presentation layer, a business logic layer, and a data access layer. MongoDB is used as the database to store and manage application data.

Table of Contents

Prerequisites

Before setting up the project, ensure you have the following installed on your machine:

Installation

1. Installing .NET SDK and Runtime

To install the .NET SDK and Runtime, execute the following commands in your terminal:

  1. Install .NET SDK 8.0:

    sudo apt-get update && \
    sudo apt-get install -y dotnet-sdk-8.0
  2. Install .NET Runtime 8.0:

    sudo apt-get update && \
    sudo apt-get install -y aspnetcore-runtime-8.0

2. Installing MongoDB

To install MongoDB, execute the following commands in your terminal:

  1. Add MongoDB's GPG key and repository:

    curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
    sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
    --dearmor
    echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
  2. Install MongoDB:

    sudo apt update
    sudo apt install -y mongodb-org
  3. Enable and Start MongoDB service:

    sudo systemctl enable mongod
    sudo systemctl start mongod

3. Setting Up MongoDB

  1. Install MongoDB Shell:

    Follow the installation guide at MongoDB Shell Installation.

  2. Access MongoDB Terminal:

    To interact with your MongoDB instance, open the MongoDB shell using:

    mongosh
  3. Manipulate Databases and Collections:

    • Show databases:

      show dbs;
    • Use a specific database:

      use db_name;
    • Show collections in the database:

      show collections;
    • Query the Products collection:

      db.Products.find().pretty();

Running the Application

To run the .NET application:

  1. Navigate to the root directory where Program.cs is located.

  2. Build the application:

    dotnet build
  3. Run the application:

    dotnet run

    The application will start, and you can access it in your web browser.

Using MongoDB Shell

To manipulate your MongoDB database using MongoDB Shell:

  1. Start the shell:

    mongosh
  2. Example commands:

    • List all databases:

      show dbs;
    • Switch to a specific database:

      use db_name;
    • Show collections in the current database:

      show collections;
    • Find all documents in a collection:

      db.Products.find().pretty();

License

This project is licensed under the MIT License - see the LICENSE file for details.

3-Tier-DotNET-MongoDB-main

3-tier-dotnet-mongodb-main's People

Watchers

KiranaItaagi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.