Development is done on Visual Sudio Mac on Mac
Up to 5 in the first part
Dapper DapperExtensions Download Mono.Data.Sqlite. In case of Gtk2 #, System.Data.Sqlite cannot be read.
Query results can be automatically included in the model. Also, Model can be used instead of the argument at the time of Update at Insert.
static public void _dapperTest() {
Mono.Data.Sqlite.SqliteConnection connection = new Mono.Data.Sqlite.SqliteConnection();
connection.ConnectionString = @"Data Source=path/test.sqlite";
connection.Open();
var query = "select * from testTable;";
var result = connection.Query<testTable>(query);
foreach(var p in result) {
Console.WriteLine("ID:" + p.test_id + "name:" + p.name);
}
connection.Close();
}
Insert statement and Update statement can be automatically generated and processed from Model
Change the format of the exported Sql statement
DapperExtensions.DapperExtensions.SqlDialect = new DapperExtensions.Sql.SqliteDialect();
static public void _dapperExtensionTest() {
//Sql statement[testTable].[test_id]From[test_id]Change to
DapperExtensions.DapperExtensions.SqlDialect = new DapperExtensions.Sql.SqliteDialect();
Mono.Data.Sqlite.SqliteConnection connection = new Mono.Data.Sqlite.SqliteConnection();
connection.ConnectionString = @"Data Source=path/test.sqlite";
connection.Open();
//Processing using Dapper Extension
testTable testTable1 = new testTable();
testTable1.name = "aaaaaa111";
connection.Insert<testTable>(testTable1);
var query = "select * from testTable;";
var result = connection.QueryFirst<testTable>(query);
//Processing using Dapper Extension
result.name += "qqqq111";
connection.Update<testTable>(result);
connection.Close();
}
testTable model
public class testTable {
public int test_id { get; set; }
public string name { get; set; }
}
Use Stoplight Studio. Register the API URL and parameters, and Swagger will be generated automatically.
OpenAPI (Swagger) tool that I really liked to use
Install Swagger Codegen and export the API client and model file in the specified language. It is convenient to customize the template.
Automatically generate various RESTful API definitions with OpenAPI Generator Swagger Codegen Swagger Codegen Git
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l Specify the language(csharp) -o Output directory
I touched swagger for the first time
Easy Raspberry Pi GUI App Development Beginner Part 2 Easy introduction to Raspberry Pi Gui application development Easy Raspberry Pi GUI application development parts sample collection
Recommended Posts