Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
25ffb9af
Commit
25ffb9af
authored
Jan 10, 2020
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Oracle
parent
ea50492b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
performance/Performance.Repository/Common/ConnectionBuilder.cs
+6
-2
performance/Performance.Repository/Common/DatabaseType.cs
+2
-1
performance/Performance.Repository/Performance.Repository.csproj
+1
-0
No files found.
performance/Performance.Repository/Common/ConnectionBuilder.cs
View file @
25ffb9af
using
MySql.Data.MySqlClient
;
using
Oracle.ManagedDataAccess.Client
;
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Data.SqlClient
;
using
System.Text
;
namespace
Performance.Repository
{
...
...
@@ -26,6 +25,8 @@ public static IDbConnection Create(DatabaseType type, string connectionString)
return
new
MySqlConnection
(
connectionString
);
case
DatabaseType
.
SqlServer
:
return
new
SqlConnection
(
connectionString
);
case
DatabaseType
.
Oracle
:
return
new
OracleConnection
(
connectionString
);
default
:
throw
new
Exception
(
$"nonsupport
{
DatabaseType
.
MySql
}
"
);
}
...
...
@@ -51,6 +52,9 @@ public static string GetConnectionString(DatabaseType type, string ip, string da
case
DatabaseType
.
SqlServer
:
connectionString
=
$"data source=
{
ip
}
;initial catalog=
{
database
}
;user id=
{
uid
}
;password=
{
pwd
}
;connection timeout=12000;"
;
break
;
case
DatabaseType
.
Oracle
:
connectionString
=
$"Password=
{
pwd
}
;User ID=
{
uid
}
;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=
{
ip
}
)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=
{
database
}
)));"
;
break
;
default
:
throw
new
Exception
(
$"nonsupport
{
DatabaseType
.
MySql
}
"
);
}
...
...
performance/Performance.Repository/Common/DatabaseType.cs
View file @
25ffb9af
...
...
@@ -7,6 +7,7 @@ namespace Performance.Repository
public
enum
DatabaseType
{
MySql
,
SqlServer
SqlServer
,
Oracle
}
}
performance/Performance.Repository/Performance.Repository.csproj
View file @
25ffb9af
...
...
@@ -9,6 +9,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" />
<PackageReference Include="MySql.Data" Version="8.0.15" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.15" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="2.19.60" />
</ItemGroup>
<ItemGroup>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment