FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
AspNetWebStack/src/WebMatrix.Data/SqlCeDbFileHandler.cs at master · develop9797/AspNetWebStack · GitHub
develop9797
AspNetWebStack
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
AspNetWebStack
/
src
/
WebMatrix.Data
/
SqlCeDbFileHandler.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (31 loc) · 1.42 KB
Breadcrumbs
AspNetWebStack
/
src
/
WebMatrix.Data
/
SqlCeDbFileHandler.cs
Copy path
File metadata and controls
37 lines (31 loc) · 1.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System
.
Diagnostics
;
using
System
.
Globalization
;
using
System
.
IO
;
namespace
WebMatrix
.
Data
{
internal
class
SqlCeDbFileHandler
:
IDbFileHandler
{
private
const
string
SqlCeConnectionStringFormat
=
@"Data Source={0};File Access Retry Timeout=10"
;
public
IConnectionConfiguration
GetConnectionConfiguration
(
string
fileName
)
{
// Get the default provider name
string
providerName
=
Database
.
GetDefaultProviderName
(
)
;
Debug
.
Assert
(
!
String
.
IsNullOrEmpty
(
providerName
)
,
"Provider name should not be null or empty"
)
;
string
connectionString
=
GetConnectionString
(
fileName
)
;
return
new
ConnectionConfiguration
(
providerName
,
connectionString
)
;
}
public
static
string
GetConnectionString
(
string
fileName
)
{
if
(
Path
.
IsPathRooted
(
fileName
)
)
{
return
String
.
Format
(
CultureInfo
.
InvariantCulture
,
SqlCeConnectionStringFormat
,
fileName
)
;
}
// Use |DataDirectory| if the path isn't rooted
string
dataSource
=
@"|DataDirectory|\"
+
Path
.
GetFileName
(
fileName
)
;
return
String
.
Format
(
CultureInfo
.
InvariantCulture
,
SqlCeConnectionStringFormat
,
dataSource
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL