Framework v Core
The Editor libraries are available for both .NET Framework and .NET Core and present an identical API for both platforms. The information in the Getting started, Validation and other sections of the .NET manual for Editor applies to both platforms. Only the installation is a little different due to the database connection required by each.
This documentation guides you through the installation and basic use of the Editor libraries on your .NET Core environment. The end result is a portable software package that can be run on Windows, Mac or Linux.
Demo package installation
环境说明: win10 专业版 python 2.7.16 django 1.11.9 遇到的问题: python的库中已经安装了mysqlclient&MySQL两个库,debug的时候还是报错: No module named MySQLdb. Did you install mysqlclient or MySQL-python? 解决方案: 在django项目的根目录下的sett. On OSX you should run 'brew install mysql' before installing mysqlclient. – ghostishev Apr 27 '18 at 9:40 I used pip3 install mysqlclient and it worked like a charm! – earnshae Aug 27 '18 at 5:14.
- Centos7 安装 python3 mysqlclient 小记 使用 centos 7 安装 python 3,在 安装 mysqlclient的时候报错 /bin/sh mysqlconfig not found 因为需要 安装 mariadb-devel ,之后再报错error: command 'gcc' failed with exit status 1,缺乏 gcc。.
- Mysqlclient, see https. For Mac OS X, or as it is now branded, macOS, use Apple’s command line tools, which can be installed with the terminal command.
This installation is a simple four step process which the documentation below will guide you though.
Download
To download the Editor .NET Core package, open the Editor download page and select the Editor .NET Core package. If you already have a DataTables account the download will start immediately. If you don't have a DataTables account you will be asked to create one to start a trial.
When the download completes, unzip the files. If you are a Visual Studio user, open the project file. If you prefer the command line, edit the files described below in your favourite Editor.
Examples SQL
We now need to load your database with the tables and data required for the Editor examples. The .NET libraries work with a number of different databases, each of which requires its own SQL. The following links contain the SQL needed for each of the supported databases:
Select the appropriate file for your database and then run the SQL contained within on your database access portal (SQL Server Management Studio, CLI, phpMyAdmin or pgAdmin3 for example). The demo SQL will create new tables and enter data into them. Note that they will overwrite any conflicting table names - installing into a new database is recommended, and also, as is good practice, ensure that you have backed up your database.
Database connection
The next step is to set up the database connection so the Editor libraries can interact with the database server. This is done through the Database
class in the DataTables
namespace, which is a database abstraction layer, so it can interface with any of the above database types.
The database connection for the demo package is configured in the Properties/launchSettings.json
file. There are DBTYPE
and DBCONNECTION
environment variables available which should be set to provide your database connection (note that there are two instances for these variables, one for IIS Express and one for a generic web-server, e.g. Nginx, replace both with your connection detaiils.
DBTYPE
- This defines the database type you are connecting to and can be one of:azure
- Microsoft Azuremysql
- MySQLpostgres
- PostgreSQLoracle
- Oraclesqlite
- SQLitesqlserver
- SQL Serversqlserverce
- SQL Server CE (for local file databases)
DBCONNECTION
- This is the database connection string to connect to the SQL server. The exact format of the connection string depends upon the server being used, but typically it includes the server host name / address, user name and password. The Connection Strings web-site can be useful if you aren't sure of what connection string to use for your server.
Running the examples
That's all the set up that is needed to run the examples! To actually run them, now press F5 or select the Start debugging option from the Debug menu in Visual Studio.
NuGet
The Editor server-side libraries for .NET are available on NuGet for easy inclusion in your project without needing to build or locally reference the DataTables-Editor-Server.dll yourself. To install via NuGet search in Visual Studio's NuGet explorer for 'DataTables-Editor-Server' and install. If you prefer to install on the command line use:
Database connection
Program
The database connection for .NET Core differs a little from .NET Framework. In .NET Framework the database drivers that are available to a program are automatically available system wide (through machine.config
). This is not the case in .NET Core and you must register the database driver you want to use - typically in Program.cs
or Startup.cs
. The registration is done using the DbProviderFactories.RegisterFactory
method:
SQL Server
MySQL
PostgreSQL
SQLite
Controllers
From this point on, the connection to the database is the same as for .NET Framework (since the data provider has been registered). In each controller a Database
class instant is initialised (note that the examples make use of the using
statement to ensure that the connection is closed when no longer required - you could call db.Close()
manually if you prefer):
A connection string. Note that the values DbType
can take is defined in the list of strings above. If using this method, you may wish to store the connection string in a global configuration like the demo examples (shown above).
Mac Mysql Client Download
An existing DbConnection
.
DbConnectionStringBuilder
.
Next steps
Mac Mysql Client Gui
Macos Mysqlclient 1.3.9
With the examples running, the next step is to start experimenting with the examples and understanding how the Editor C# code operates. Beyond that, you can start to include Editor in your own applications (Web API / MVC)!