Skip to content

Commit 05ba62e

Browse files
committed
Update NETCoreMySQL
1 parent 4291579 commit 05ba62e

File tree

5 files changed

+22
-13
lines changed

5 files changed

+22
-13
lines changed

NETCoreMySQL/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#NETCoreMySQL
22

3-
[.NET Core 使用Dapper 操作MySQL](http://www.cnblogs.com/linezero/p/NETCoreMySQL.html)
3+
[.NET Core 使用Dapper 操作MySQL](http://www.cnblogs.com/linezero/p/NETCoreMySQL.html)
4+
5+
[MySQL官方.NET Core驱动已出,支持EF Core](http://www.cnblogs.com/linezero/p/5806814.html)

NETCoreMySQL/global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"projects": [ "src", "test" ],
33
"sdk": {
4-
"version": "1.0.0-preview1-002702"
4+
"version": "1.0.0-preview2-003121"
55
}
66
}

NETCoreMySQL/src/NETCoreMySQL/NETCoreMySQL.xproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
66
</PropertyGroup>
7-
87
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
98
<PropertyGroup Label="Globals">
109
<ProjectGuid>de5b5364-4955-42f5-95c0-bd0e2aecf10b</ProjectGuid>
@@ -13,9 +12,13 @@
1312
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
1413
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
1514
</PropertyGroup>
16-
1715
<PropertyGroup>
1816
<SchemaVersion>2.0</SchemaVersion>
1917
</PropertyGroup>
2018
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
21-
</Project>
19+
<ProjectExtensions>
20+
<VisualStudio>
21+
<UserProperties />
22+
</VisualStudio>
23+
</ProjectExtensions>
24+
</Project>

NETCoreMySQL/src/NETCoreMySQL/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,25 @@
55
using System.Threading.Tasks;
66
using Dapper;
77
using System.Text;
8+
using Microsoft.Extensions.Configuration;
9+
using System.IO;
810

911
namespace NETCoreMySQL
1012
{
1113
public class Program
1214
{
1315
public static void Main(string[] args)
1416
{
15-
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
16-
MySqlConnection con = new MySqlConnection("server=127.0.0.1;database=test;uid=root;pwd=;charset='gbk'");
17+
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
18+
MySqlConnection con = new MySqlConnection("server=127.0.0.1;database=test;uid=root;pwd=;charset='gbk';SslMode=None");
1719
//新增数据
1820
con.Execute("insert into user values(null, '测试', 'http://www.cnblogs.com/linezero/', 18)");
1921
//新增数据返回自增id
20-
var id=con.QueryFirst<int>("insert into user values(null, 'linezero', 'http://www.cnblogs.com/linezero/', 18);select last_insert_id();");
22+
var id = con.QueryFirst<int>("insert into user values(null, 'linezero', 'http://www.cnblogs.com/linezero/', 18);select last_insert_id();");
2123
//修改数据
2224
con.Execute("update user set UserName = 'linezero123' where Id = @Id", new { Id = id });
2325
//查询数据
24-
var list=con.Query<User>("select * from user");
26+
var list = con.Query<User>("select * from user");
2527
foreach (var item in list)
2628
{
2729
Console.WriteLine($"用户名:{item.UserName} 链接:{item.Url}");

NETCoreMySQL/src/NETCoreMySQL/project.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
},
66

77
"dependencies": {
8-
"Dapper": "1.50.0-rc2b",
8+
"Dapper": "1.50.2",
9+
"Microsoft.Extensions.Configuration": "1.0.0",
10+
"Microsoft.Extensions.Configuration.Json": "1.0.0",
911
"Microsoft.NETCore.App": {
1012
"type": "platform",
11-
"version": "1.0.0-rc2-3002702"
13+
"version": "1.0.0"
1214
},
13-
"SapientGuardian.MySql.Data": "6.9.8-rc2-007",
14-
"System.Text.Encoding.CodePages": "4.0.1-rc2-24027"
15+
"MySql.Data.Core": "7.0.4-IR-191",
16+
"System.Text.Encoding.CodePages": "4.0.1"
1517
},
1618

1719
"frameworks": {

0 commit comments

Comments
 (0)