Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
ba980501
Commit
ba980501
authored
Aug 19, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 SQLiteDbContext InitNoBuild() 当只是数据库少了个表,自动添加进去。 当正常加载成功
parent
5ed48454
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
7 deletions
+27
-7
SQLiteDbContext.cs
Project.SQLiteHelper/SQLiteHelper/SQLiteDbContext.cs
+27
-7
No files found.
Project.SQLiteHelper/SQLiteHelper/SQLiteDbContext.cs
View file @
ba980501
...
@@ -214,15 +214,35 @@ namespace SQLite
...
@@ -214,15 +214,35 @@ namespace SQLite
{
{
ddls
.
Add
(
tb
.
TableName
,
tb
.
DDL
);
ddls
.
Add
(
tb
.
TableName
,
tb
.
DDL
);
}
}
if
(
sqliteHelper
.
IsTableValid
(
ddls
))
{
bool
isVaild
=
sqliteHelper
.
IsTableValid
(
ddls
,
out
Dictionary
<
string
,
SQLiteHelper
.
IsTableValidResult
>
results
);
Load
();
return
true
;
if
(!
isVaild
)
//不合法
}
else
{
{
return
false
;
if
(
results
.
Any
(
kv
=>
kv
.
Value
==
SQLiteHelper
.
IsTableValidResult
.
FormatErr
))
{
//格式不对,无法容忍
return
false
;
}
//有表 不对
foreach
(
var
kv
in
results
)
{
switch
(
kv
.
Value
)
{
case
SQLiteHelper
.
IsTableValidResult
.
NotHere
:
{
//直接创建表
sqliteHelper
.
ExecuteNonQuery
(
ddls
[
kv
.
Key
]);
}
break
;
}
}
}
}
Load
();
return
true
;
}
}
/// <summary>
/// <summary>
...
...
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