Quick Start

How to develop

  • fork code to your own repository
  • Add a branch to develop your own business e.g. business;
  • The master branch is used to pull and sync the latest code and then merge the latest code pulled into your own business branch

Development preparation

vs2022 and above and vscode (for front-end development)

vsCode recommends installing the following plugins

volar(vue3)
volar(vue3)
vetur(vue2)
Chinese (Simplified).
eslint.
i18n Ally(Multi-language)
vue-component

Install .netSdk (https://dotnet.microsoft.com/zh-cn/download/dotnet)open in new window

Database either one of the following (tested)

- MySql >= 5.7.0
- SqlServer >= 2008 (recommended 2012 or higher)
- Oracle
- PgSql >= 15
- Other databases are theoretically supported (test libraries can be provided for testing if needed)

node environment

Node >= 16

node download addressopen in new window

node installation stepsopen in new window

Note

After installing node on the front end, it is best to set the Taobao mirror source, it is not recommended to use cnpm (strange problems may occur)
npm install --registry=https://registry.npm.taobao.org

Check out the node installation

C:\Users\admin>node -v
v16.15.0
C:\Users\admin>npm -v
9.4.1

Newer versions of node already integrate with npm, so no additional installation is needed

Check the npm mirror address

  C:\Users\admin>npm get registry
  https://registry.npmjs.org/

Install vue scaffolding

npm install -g @vue/cli

Note that

Because this project is front- and back-end separated, you need to start both front- and back-end before you can access

Backend Start

  1. Pull items
## Clone the project
git clone https://github.com/Lean365/LaplaceNet.git d:/LaplaceNet/

## Access the project
cd LaplaceNet

## Open the project
Open the Laplace.Net.sln solution

## Run the project
Set La.WebApi as the startup project and run startup.bat in the root of the project to start it

## Package and publish
Select La.WebApi right-click menu and click Publish
  1. Create Laplace_Dev database and create database table, the file is in the root directory document, choose your own corresponding database file, you can also build the database by codefirst

  2. Through the database script

document
│
├─mysql
│ admin-mysql-initial-data.sql -> seed data
│ admin-mysql.sql -> database table
│
├─pgsql
│ admin-pg15.sql -> database table
│ admin-pg15-initialization-data.sql ->seed-data
│
└─sqlserver
│ admin-sqlserver-initialization-data.sql -> seed data
│ admin-sqlserver-table-fields-description-import.sql
│ admin-sqlserver.sql -> database table
└─oracle
│ seq.text ->oracle sequence

2、Build a database table through codefirst (recommended) Currently only support framework net7 or above use

Set the appsettings.json configuration file, set the following false to true, then restart the program can automatically create the database table, the next step to import the seed data

{
  "InitDb": false // whether to initialize the db
}

Modify the appsettings.json configuration file

"dbConfigs": [
	// business library
	{
		"Conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=admin;Password=admin123;Initial Catalog=ZrAdmin;".
		"DbType": 1, // database type MySql = 0, SqlServer = 1, Oracle = 3, PgSql = 4
		"ConfigId": "0",//
		"IsAutoCloseConnection": true // whether to release automatically
	}.
	// code generation using
	{
		"Conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=admin;Password=admin123;Initial Catalog={dbName};".
		"DbType": 1.
		"IsAutoCloseConnection": true.
		"DbName": "ZrAdmin",//code generation default connection to the database
		"IsGenerateDb": true // whether code generation using the library, do not change
	}
	//... Add more database sources below
].

Database connection string format reference

MySQL
#The system built-in mysql driver does not need to be installed
Data Source=localhost;port=3306;User ID=sa;Password=zradmin123;Database=ZrAdmin;CharSet=utf8;sslmode=none.

sqlserver
Data Source=localhost;Initial Catalog=ZrAdmin;User ID=sa;Password=zradmin123.

Oracle
# Core
data source = localhost/orcl;user id= ZrAdmin; password=zradmin123;persist security info=false

PgSql
# Need to install driver by yourself: Npgsql
HOST=localhost;PORT=5342;DATABASE=ZrAdmin;USERID=xxx;PASSWORD=zradmin123.

The following will appear if the startup is successful, if it fails please check the project directory admninLogs folder log

   __                __                  _   __     __
   / /   ____ _____  / /___ _________    / | / /__  / /_
  / /   / __ `/ __ \/ / __ `/ ___/ _ \  /  |/ / _ \/ __/
 / /___/ /_/ / /_/ / / /_/ / /__/  __/ / /|  /  __/ /_
/_____/\__,_/ .___/_/\__,_/\___/\___(_)_/ |_/\___/\__/
           /_/

                                                  Author: Davis.Cheng
                                                    Date:---
SwaggerDoc: La.WebApi.xml
源码地址: https://github.com/Lean365/LaplaceNet
官方文档:https://laplacenet.github.io/
打赏作者:https://laplacenet.github.io/docs/others/donate.html

The backend run successfully can be accessed through (http://localhost:8888), but no static page will appear, you can continue to refer to the following steps to deploy the frontend, and then access through the frontend address.

About the seed data

1、Can be imported by the above script
2、Import through the interface (recommended) http://localhost:8888/common/initseedData

Front-end startup Please make sure you have installed node environment

vue3.x

# Clone the code (project with vue3.x in it)
git clone https://github.com/Lean365/LaplaceNet.git

# Go to the project directory
cd La.vue

# Install the dependencies
npm install

# Start the service
npm run dev

# Build the test environment npm build:stage
# Build the production environment npm build:prod
# Access the front end at http://localhost:8887

# If building with yarn install npm install yarn

Open the browser and enter: (http://localhost:8887) Default account/password admin/123456 If the login page is displayed correctly and you can log in successfully, and the menu and page are displayed normally, the environment is set up successfully

npm configuration (not necessary)

node installation process: omitted Here node will be installed to D:\nodejs directory

First configure the path to the global modules and the cache path of npm by creating two new folders, node_cache and node_global, in the d:\nodejs directory

Start cmd, and then execute the following 2 commands

npm config set prefix "D:\nodejs\node_global"
npm config set cache "D:\nodejs\node_cache"

To see if the settings are successful, type the following command in cmd

npm config get prefix
//If you output D:\nodejs\node_global, it means success
npm config get cache
//will output D:\nodejs\node_cache

Finally, we have to modify the system environment variables ("This computer - right click - properties - advanced system settings - environment variables"). First, create a new variable NODE_PATH in the user variables, with the value of node_modules in the nodejs installation folder, i.e. D:\nodejs\node_modules

Then, add node_global to the Path variable of the system variable, and paste D:\nodejs\node_global into node