Skip to content

fasteddys/dotnetGen_mysql

 
 

Repository files navigation

.NETCore 2.1 + Mysql generator

The author has been oriented to web application development for 13 years. In the project practice and learning, he replaced the old with the new, absorbed the advantages, accumulated from the direction of high quality, strong specification, and rapid development, and formed a generator tool to reduce the difficulty of project back-end development.

The navicat model tool creates and manages ER diagrams, imports/synchronizes structures from the database to the database, and then uses this generator to synchronize c# entities with one click, as well as various standardized styles and grammars that you can't imagine, supports caching, and supports databases 99% type, mining database characteristics, avoiding excessive duplication of labor and non-standard and unrobust codes.

Advantage:

    1. Generate a feature-rich database SDK based on primary key, unique key, and foreign key (1-to-1, 1-to-many, many-to-many);
    1. Strictly control the database, avoid creating tables or fields at will, and have standard ER diagram database specifications;
    1. Unify and standardize database operation classes and methods (compared with EF's too casual usage, which is much easier to manage), and concentrate on business;
    1. Optimize every detail, and never allow low-level errors to interfere with our business logic (compared to ORM, the generated code is more focused);

Suitable for the occasion:

    1. For new project development, only design data ER diagrams, without considering db related codes;
    1. The old project database access method is unsightly, the more tables, the greater the benefits;

Download the winform client of the generator, it is recommended to install the command tool dotnet tool install -g GenMy

Learning QQ group: 8578575


build on existing project

dotnet new mvc
GenMy database ip[:3306] -U login name -P password -D database1[,database2] -N namespace

Generate a complete modular solution

GenMy database ip[:3306] -U login name -P password -D database1[,database2] -N namespace -R -S -A

dotnetGen maintains the same development and usage habits, and realizes rapid development for three databases including mysql, SQLServer, and PostgreSQL, and can also be used in combination.

| Function comparison | dotnetGen_mysql | dotnetGen_sqlserver | dotnetGen_postgresql | | ----------------: | --------------: | --------------- ----: | -------------------: | | windows | √ | √ | √ | | linux | √ | √ | √ | | Connection Pool | √ | √ | √ | | Affairs | √ | √ | √ | | Multiple databases | √ | - | - | | Read-write separation | √ | √ | √ | | table | √ | √ | √ | | Table relationship (1 to 1) | √ | √ | √ | | Table relationship (1 to many) | √ | √ | √ | | Table relationship (many to many) | √ | √ | √ | | table primary key | √ | √ | √ | | table unique key | √ | √ | √ | | stored procedure | - | √ | - | | View | √ | √ | √ | | soft delete | √ | √ | √ | | Type Mapping | √ | √ | √ | | Enum | √ | - | √ | | Custom Type | - | - | √ | | gis | √ | - | √ | | array | - | - | √ | | Dictionary | - | - | √ | |xml|-|-|-| | json | - | - | √ | | Cache | √ | √ | √ | | Command line generation | √ | √ | √ | | RESTful | √ | √ | √ | | Background management function | √ | √ | √ |

Test database

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for song
-- ----------------------------
DROP TABLE IF EXISTS `song`;
CREATE TABLE `song` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `title` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'title',
   `url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'address',
   `create_time` datetime DEFAULT NULL COMMENT 'create time',
   PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- ----------------------------
-- Table structure for song_tag
-- ----------------------------
DROP TABLE IF EXISTS `song_tag`;
CREATE TABLE `song_tag` (
   `song_id` int(11) NOT NULL COMMENT 'song',
   `tag_id` int(11) NOT NULL COMMENT 'tag',
   PRIMARY KEY (`song_id`, `tag_id`),
   KEY `fk_song_tag_tag_1` (`tag_id`),
   CONSTRAINT `fk_song_tag_song_1` FOREIGN KEY (`song_id`) REFERENCES `song` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
   CONSTRAINT `fk_song_tag_tag_1` FOREIGN KEY (`tag_id`) REFERENCES `tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- ----------------------------
-- Table structure for tags
-- ----------------------------
DROP TABLE IF EXISTS `tag`;
CREATE TABLE `tag` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `parent_id` int(11) DEFAULT NULL COMMENT 'parent label',
   `name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'name',
   PRIMARY KEY (`id`),
   KEY `fk_tag_tag_1` (`parent_id`),
   CONSTRAINT `fk_tag_tag_1` FOREIGN KEY (`parent_id`) REFERENCES `tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- ----------------------------
-- Table structure for topic
-- ----------------------------
DROP TABLE IF EXISTS `topic`;
CREATE TABLE `topic` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `title` varchar(255) DEFAULT NULL COMMENT 'title',
   `cardtype` enum('video','text 01','text 02','link') DEFAULT NULL COMMENT 'card type',
   `carddata` text COMMENT 'Card rendering data',
   `content` text COMMENT 'content',
   `clicks` bigint(20) unsigned DEFAULT NULL COMMENT 'clicks',
   `create_time` datetime DEFAULT NULL COMMENT 'create time',
   `update_time` datetime DEFAULT NULL COMMENT 'modified time',
   `order_time` datetime DEFAULT NULL COMMENT 'order time',
   PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Introduction to the modular framework directory structure

Module

All business interface agreements are divided into modules and developed in parallel, independent of each other

Module/Admin The generated background management module can be accessed at http://localhost:5001/module/Admin

Module/Test Generated test module

WebHost

When compiling WebHost, the compilation result of Module/* will be copied to the current directory WebHost is only loaded on demand when running as the main engine

About

.NETCore + Mysql 生成器

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.6%
  • Other 0.4%