Skip to content

DevsoIO/prisma-to-csharp

Repository files navigation

Introduction

This small app allows you to load a prisma schema file, select which table or model you want to convert, and then generates the corresponding C# class code to use as your Entity Framework model.

I built this app quickly for my own needs so its functionality might be limited, but feel free to use it as you see fit!

I only use MySQL/MariaDB with prisma so that app only supports that, I'm assuming other databases might have different types/options that are available in prisma so these won't be recognised or converted correctly.

I am aware that this might not be considered the best code as it parses the schema file multiple times and does some basic string searching and manipulation, however my prisma schema files aren't huge so it works fine for my needs, and I think you would have to have a very large schema file to see a performance issue.

Development

The app was built using Vite + React + Typescript. To run it locally do the following:

git clone https://github.com/DevsoIO/prisma-to-charp
cd prisma-to-charp
npm install
npm run dev

Then open your browser to the address shown in the terminal, usually http://localhost:5174.

Run under Docker

The app is also available as a Docker container on hub.docker.com. To run it run the below command

docker run -d --name prisma-to-csharp \
-p 8080:8080 --restart=always \
chrisfromdevso/prisma-to-csharp:latest

About

Convert your prisma schema file (MySQL/MariaDB) into C# Entity Framework Model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors