Saturday, March 29, 2025

๐Ÿš€ How to Copy a SQL Server Database Using a .bacpac File (Schema + Data) || Clone DB

#Clone Database 
Need to duplicate a full SQL Server database — including tables, views, stored procedures and data — without writing complex scripts?

Let me show you a simple, reliable method: Exporting and Importing a Data-tier Application (.bacpac). It’s perfect for backups, migrations, and creating dev/test clones.


 Step 1: Export the Source Database

  1. Open SQL Server Management Studio (SSMS).

  2. Right-click your source database → Tasks → Export Data-tier Application.

  3. Choose "Save to local disk", then pick a file path and name (YourDatabase.bacpac).

  4. Click Next through the wizard and generate the .bacpac file.


 Step 2: Import into Target Server

  1. In SSMS, right-click DatabasesImport Data-tier Application.

  2. Select the .bacpac file you exported.

  3. Give the new database a name.

  4. Complete the wizard. ๐ŸŽ‰ Done!


๐Ÿงฉ Diagram

[ Source DB ] | | Export as .bacpac ↓ [ YourFile.bacpac ] | | Import on Target Server ↓ [ New DB Clone ]

Why Use This?

  • ๐Ÿ”„ Migrate databases between environments (dev, staging, prod).

  • ๐Ÿ› ️ Create dev/test clones without risking production.

  • ๐Ÿ“ฆ Archive snapshots with both schema and data.

Friday, March 14, 2025

Run ai model in python code with ollama

 First download and install ollama By this blog:
Tech Journey With Gagan: Run Any AI Model with ollama in windows

For Use AI model in python:
1. run this script
Note: this example for mistral ai model please change acording to your model

Declare function


For run

it is work like this


Option 2: 
Run server explicitly 

1. Click on Quit Ollama


2. run server with ollama serve mean in cmd type "ollama serve".



Run Any AI Model with ollama in windows

Steps for install Any model with ollama in local : 
1. Download Olama  and install 


2.  open cmd and run "ollama" command to verify that ollama installed or not.



3. Install models  
    a. find your model and click on it.

   b. copy command and paste into terminal





                      press Enter now your model installed 

Note :Later on same command run your model will run automatically this time it is not downloading it just run 



How To work python with ollama: Run AI Model with Python

Friday, March 7, 2025

๐Ÿ˜ฎCreate Task Scheduler app using AI Agent in just before 2 min ๐Ÿ˜ฎ



Steps to create :
1. use Cline Agent extention in vs code.
2. use api of AI models like.
3. Give prompt to Cline.
4. Work automatically give you clean app.
Note: No need to create any file it will do automatically.

GitHub Repository Viewer

๐Ÿ“Œ GitHub Repository Viewer

Loading...


Git Hub Repo Link Here

Thursday, March 6, 2025

Building a C# Web API with Onion Architecture, CQRS, MediatR & Quartz.NET CRON Jobs

 


Introduction

In modern C# applications, clean architecture plays a crucial role in maintaining scalability and maintainability. In this blog, we will build a C# Web API using Onion Architecture, CQRS, MediatR, and Quartz.NET for scheduling background jobs. This guide will walk you through structuring a project with best practices and SOLID principles.

Why Use Onion Architecture?

Onion Architecture provides a clear separation of concerns by organizing the application into different layers:

  1. Domain Layer → Contains core business logic and entities

  2. Application Layer → Contains CQRS commands, queries, and interfaces

  3. Infrastructure Layer → Handles database, repository pattern, and external integrations

  4. Presentation Layer (API Layer) → Exposes the application as an API

Tech Stack

  • ASP.NET Core Web API for building RESTful APIs

  • Entity Framework Core for database operations

  • CQRS Pattern for separating read & write operations

  • MediatR for in-memory messaging

  • Quartz.NET for CRON Job scheduling

  • SOLID Principles to make the application scalable

    ๐Ÿ“Œ Project Structure

    Your project will be structured as follows:

    Architecture Snippet

    Step 1: Create the Student Model (Domain Layer)

    ๐Ÿ“ Location: Onion.Domain/Models/Student.cs

    Model Snippet

    Step 2: Create CQRS Commands & Queries (Application Layer)

    ✅ Command to Create a Student

    ๐Ÿ“ Location: Onion.Application/Features/Students/Commands/CreateStudentCommand.cs

    Code Snippet

    ✅ Query to Get All Students

    ๐Ÿ“ Location: Onion.Application/Features/Students/Queries/GetAllStudentsQuery.cs

    Code Snippet

    Step 3: Implement Repository (Infrastructure Layer)

    ๐Ÿ“ Location: Onion.Infrastructure/Repositories/StudentRepository.cs

    Code Snippet

    Step 4: Implement CRON Job Using Quartz.NET

    ๐Ÿ“ Location: Onion.Infrastructure/Scheduler/CronJobService.cs

    Code Snippet

    Step 5: Register Everything in Program.cs (API Layer)

    ๐Ÿ“ Location: Onion.API/Program.cs

    Code Snippet

    Conclusion

    By following this guide, you have successfully built a C# Web API with Onion Architecture, CQRS, MediatR, and Quartz.NET CRON Jobs.
    This approach ensures:
    Scalability using Onion Architecture
    Separation of Concerns (SoC)
    Background Job Execution with Quartz.NET
    Better Maintainability with CQRS & MediatR

    ๐Ÿš€ Download Full Project
    Github

๐Ÿ”ฅ "Building a C# Web API with Onion Architecture, CQRS, MediatR & Quartz.NET CRON Jobs Project" ๐Ÿš€


Cover In this:
✅ Onion Architecture ka Overview
✅ CQRS Pattern + MediatR used
✅ Quartz.NET ke sath CRON Jobs
✅ Dependency Injection & SOLID
✅ GitHub :https://github.com/gaganmanakpuria/AddStudentCronJobWithOnionArchitectureWithSOLID


GitHub Repository Viewer

๐Ÿ“Œ GitHub Repository Viewer

Loading...

How to Do Cross-Browser Testing on Windows — Including Safari via Playwright

To test follow few steps: Step 1. Install node Step 2. create Folder and run these commands commands Copy Code ...