mirror of
https://github.com/jie65535/SQLiteEFCodeFirstDemo.git
synced 2024-07-27 19:15:15 +08:00
添加项目文件。
This commit is contained in:
parent
4a6311b4cc
commit
0140690500
25
SQLiteEFCodeFirstDemo.sln
Normal file
25
SQLiteEFCodeFirstDemo.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.30406.217
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLiteEFCodeFirstDemo", "SQLiteEFCodeFirstDemo\SQLiteEFCodeFirstDemo.csproj", "{A8A315F7-36C3-4812-9F09-EF13582E7F68}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{A8A315F7-36C3-4812-9F09-EF13582E7F68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A8A315F7-36C3-4812-9F09-EF13582E7F68}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A8A315F7-36C3-4812-9F09-EF13582E7F68}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A8A315F7-36C3-4812-9F09-EF13582E7F68}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {53D098E6-8F56-4CED-8299-B9406CC0A257}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
29
SQLiteEFCodeFirstDemo/App.config
Normal file
29
SQLiteEFCodeFirstDemo/App.config
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
|
</configSections>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
|
</startup>
|
||||||
|
<entityFramework>
|
||||||
|
<providers>
|
||||||
|
<!-- 设定提供者为SQLite -->
|
||||||
|
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||||
|
</providers>
|
||||||
|
</entityFramework>
|
||||||
|
<system.data>
|
||||||
|
<DbProviderFactories>
|
||||||
|
<remove invariant="System.Data.SQLite.EF6" />
|
||||||
|
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
|
||||||
|
<remove invariant="System.Data.SQLite" />
|
||||||
|
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
|
||||||
|
</DbProviderFactories>
|
||||||
|
</system.data>
|
||||||
|
<connectionStrings>
|
||||||
|
<!-- 数据库连接字符串
|
||||||
|
当保存GUID时,SQLite使用Blob存储,导致Linq无法用其与C#的Guid判断相等,因此设为以Text存储 BinaryGUID=False -->
|
||||||
|
<add name="MyDatabase" connectionString="data source=data.db;BinaryGUID=False" providerName="System.Data.SQLite.EF6" />
|
||||||
|
</connectionStrings>
|
||||||
|
</configuration>
|
39
SQLiteEFCodeFirstDemo/Configuration.cs
Normal file
39
SQLiteEFCodeFirstDemo/Configuration.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using System.Data.Entity.Migrations;
|
||||||
|
using System.Data.SQLite.EF6.Migrations;
|
||||||
|
|
||||||
|
namespace SQLiteEFCodeFirstDemo
|
||||||
|
{
|
||||||
|
public class Configuration : DbMigrationsConfiguration<MyDatabase>
|
||||||
|
{
|
||||||
|
public Configuration()
|
||||||
|
{
|
||||||
|
AutomaticMigrationsEnabled = true;
|
||||||
|
AutomaticMigrationDataLossAllowed = true;
|
||||||
|
SetSqlGenerator("System.Data.SQLite", new SQLiteMigrationSqlGenerator());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Seed(MyDatabase context)
|
||||||
|
{
|
||||||
|
context.Users.AddOrUpdate(
|
||||||
|
new Models.User { ID = 1, Name = "张三", Age = 22, Gender = "男", Location = "北京"},
|
||||||
|
new Models.User { ID = 2, Name = "李四", Age = 23, Gender = "男", Location = "上海"},
|
||||||
|
new Models.User { ID = 3, Name = "王五", Age = 30, Gender = "男", Location = "广州"},
|
||||||
|
new Models.User { ID = 4, Name = "赵六", Age = 27, Gender = "男", Location = "安徽"},
|
||||||
|
new Models.User { ID = 5, Name = "张丽", Age = 19, Gender = "女", Location = "深圳"}
|
||||||
|
);
|
||||||
|
|
||||||
|
// This method will be called after migrating to the latest version.
|
||||||
|
|
||||||
|
// You can use the DbSet<T>.AddOrUpdate() helper extension method
|
||||||
|
// to avoid creating duplicate seed data. E.g.
|
||||||
|
//
|
||||||
|
// context.People.AddOrUpdate(
|
||||||
|
// p => p.FullName,
|
||||||
|
// new Person { FullName = "Andrew Peters" },
|
||||||
|
// new Person { FullName = "Brice Lambson" },
|
||||||
|
// new Person { FullName = "Rowan Miller" }
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
298
SQLiteEFCodeFirstDemo/FormMain.Designer.cs
generated
Normal file
298
SQLiteEFCodeFirstDemo/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,298 @@
|
|||||||
|
namespace SQLiteEFCodeFirstDemo
|
||||||
|
{
|
||||||
|
partial class FormMain
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 必需的设计器变量。
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理所有正在使用的资源。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows 窗体设计器生成的代码
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设计器支持所需的方法 - 不要修改
|
||||||
|
/// 使用代码编辑器修改此方法的内容。
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||||
|
this.BtnCreate = new System.Windows.Forms.Button();
|
||||||
|
this.BtnRefresh = new System.Windows.Forms.Button();
|
||||||
|
this.BtnUpdate = new System.Windows.Forms.Button();
|
||||||
|
this.BtnDelete = new System.Windows.Forms.Button();
|
||||||
|
this.LblText = new System.Windows.Forms.Label();
|
||||||
|
this.TxtID = new System.Windows.Forms.TextBox();
|
||||||
|
this.LblID = new System.Windows.Forms.Label();
|
||||||
|
this.BtnQuery = new System.Windows.Forms.Button();
|
||||||
|
this.TxtKeyword = new System.Windows.Forms.TextBox();
|
||||||
|
this.LblKeyword = new System.Windows.Forms.Label();
|
||||||
|
this.BtnSearch = new System.Windows.Forms.Button();
|
||||||
|
this.LblName = new System.Windows.Forms.Label();
|
||||||
|
this.TxtName = new System.Windows.Forms.TextBox();
|
||||||
|
this.CmbGender = new System.Windows.Forms.ComboBox();
|
||||||
|
this.LblGender = new System.Windows.Forms.Label();
|
||||||
|
this.LblAge = new System.Windows.Forms.Label();
|
||||||
|
this.TxtAge = new System.Windows.Forms.TextBox();
|
||||||
|
this.LblLocation = new System.Windows.Forms.Label();
|
||||||
|
this.TxtLocation = new System.Windows.Forms.TextBox();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView1
|
||||||
|
//
|
||||||
|
this.dataGridView1.AllowUserToAddRows = false;
|
||||||
|
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||||
|
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.dataGridView1.Location = new System.Drawing.Point(218, 64);
|
||||||
|
this.dataGridView1.Name = "dataGridView1";
|
||||||
|
this.dataGridView1.ReadOnly = true;
|
||||||
|
this.dataGridView1.RowTemplate.Height = 23;
|
||||||
|
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
this.dataGridView1.Size = new System.Drawing.Size(474, 259);
|
||||||
|
this.dataGridView1.TabIndex = 0;
|
||||||
|
this.dataGridView1.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowEnter);
|
||||||
|
//
|
||||||
|
// BtnCreate
|
||||||
|
//
|
||||||
|
this.BtnCreate.Location = new System.Drawing.Point(24, 299);
|
||||||
|
this.BtnCreate.Name = "BtnCreate";
|
||||||
|
this.BtnCreate.Size = new System.Drawing.Size(50, 23);
|
||||||
|
this.BtnCreate.TabIndex = 9;
|
||||||
|
this.BtnCreate.Text = "创建";
|
||||||
|
this.BtnCreate.UseVisualStyleBackColor = true;
|
||||||
|
this.BtnCreate.Click += new System.EventHandler(this.BtnCreate_Click);
|
||||||
|
//
|
||||||
|
// BtnRefresh
|
||||||
|
//
|
||||||
|
this.BtnRefresh.Location = new System.Drawing.Point(617, 22);
|
||||||
|
this.BtnRefresh.Name = "BtnRefresh";
|
||||||
|
this.BtnRefresh.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.BtnRefresh.TabIndex = 12;
|
||||||
|
this.BtnRefresh.Text = "刷新";
|
||||||
|
this.BtnRefresh.UseVisualStyleBackColor = true;
|
||||||
|
this.BtnRefresh.Click += new System.EventHandler(this.BtnRefresh_Click);
|
||||||
|
//
|
||||||
|
// BtnUpdate
|
||||||
|
//
|
||||||
|
this.BtnUpdate.Location = new System.Drawing.Point(83, 299);
|
||||||
|
this.BtnUpdate.Name = "BtnUpdate";
|
||||||
|
this.BtnUpdate.Size = new System.Drawing.Size(50, 23);
|
||||||
|
this.BtnUpdate.TabIndex = 10;
|
||||||
|
this.BtnUpdate.Text = "更新";
|
||||||
|
this.BtnUpdate.UseVisualStyleBackColor = true;
|
||||||
|
this.BtnUpdate.Click += new System.EventHandler(this.BtnUpdate_Click);
|
||||||
|
//
|
||||||
|
// BtnDelete
|
||||||
|
//
|
||||||
|
this.BtnDelete.Location = new System.Drawing.Point(142, 299);
|
||||||
|
this.BtnDelete.Name = "BtnDelete";
|
||||||
|
this.BtnDelete.Size = new System.Drawing.Size(50, 23);
|
||||||
|
this.BtnDelete.TabIndex = 11;
|
||||||
|
this.BtnDelete.Text = "删除";
|
||||||
|
this.BtnDelete.UseVisualStyleBackColor = true;
|
||||||
|
this.BtnDelete.Click += new System.EventHandler(this.BtnDelete_Click);
|
||||||
|
//
|
||||||
|
// LblText
|
||||||
|
//
|
||||||
|
this.LblText.AutoSize = true;
|
||||||
|
this.LblText.Location = new System.Drawing.Point(216, 327);
|
||||||
|
this.LblText.Name = "LblText";
|
||||||
|
this.LblText.Size = new System.Drawing.Size(0, 12);
|
||||||
|
this.LblText.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// TxtID
|
||||||
|
//
|
||||||
|
this.TxtID.Location = new System.Drawing.Point(49, 23);
|
||||||
|
this.TxtID.Name = "TxtID";
|
||||||
|
this.TxtID.Size = new System.Drawing.Size(63, 21);
|
||||||
|
this.TxtID.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// LblID
|
||||||
|
//
|
||||||
|
this.LblID.AutoSize = true;
|
||||||
|
this.LblID.Location = new System.Drawing.Point(22, 27);
|
||||||
|
this.LblID.Name = "LblID";
|
||||||
|
this.LblID.Size = new System.Drawing.Size(23, 12);
|
||||||
|
this.LblID.TabIndex = 0;
|
||||||
|
this.LblID.Text = "ID:";
|
||||||
|
//
|
||||||
|
// BtnQuery
|
||||||
|
//
|
||||||
|
this.BtnQuery.Location = new System.Drawing.Point(118, 22);
|
||||||
|
this.BtnQuery.Name = "BtnQuery";
|
||||||
|
this.BtnQuery.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.BtnQuery.TabIndex = 2;
|
||||||
|
this.BtnQuery.Text = "查找";
|
||||||
|
this.BtnQuery.UseVisualStyleBackColor = true;
|
||||||
|
this.BtnQuery.Click += new System.EventHandler(this.BtnQuery_Click);
|
||||||
|
//
|
||||||
|
// TxtKeyword
|
||||||
|
//
|
||||||
|
this.TxtKeyword.Location = new System.Drawing.Point(269, 23);
|
||||||
|
this.TxtKeyword.Name = "TxtKeyword";
|
||||||
|
this.TxtKeyword.Size = new System.Drawing.Size(100, 21);
|
||||||
|
this.TxtKeyword.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// LblKeyword
|
||||||
|
//
|
||||||
|
this.LblKeyword.AutoSize = true;
|
||||||
|
this.LblKeyword.Location = new System.Drawing.Point(216, 27);
|
||||||
|
this.LblKeyword.Name = "LblKeyword";
|
||||||
|
this.LblKeyword.Size = new System.Drawing.Size(47, 12);
|
||||||
|
this.LblKeyword.TabIndex = 0;
|
||||||
|
this.LblKeyword.Text = "关键字:";
|
||||||
|
//
|
||||||
|
// BtnSearch
|
||||||
|
//
|
||||||
|
this.BtnSearch.Location = new System.Drawing.Point(375, 22);
|
||||||
|
this.BtnSearch.Name = "BtnSearch";
|
||||||
|
this.BtnSearch.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.BtnSearch.TabIndex = 4;
|
||||||
|
this.BtnSearch.Text = "搜索";
|
||||||
|
this.BtnSearch.UseVisualStyleBackColor = true;
|
||||||
|
this.BtnSearch.Click += new System.EventHandler(this.BtnSearch_Click);
|
||||||
|
//
|
||||||
|
// LblName
|
||||||
|
//
|
||||||
|
this.LblName.AutoSize = true;
|
||||||
|
this.LblName.Location = new System.Drawing.Point(21, 120);
|
||||||
|
this.LblName.Name = "LblName";
|
||||||
|
this.LblName.Size = new System.Drawing.Size(35, 12);
|
||||||
|
this.LblName.TabIndex = 0;
|
||||||
|
this.LblName.Text = "姓名:";
|
||||||
|
//
|
||||||
|
// TxtName
|
||||||
|
//
|
||||||
|
this.TxtName.Location = new System.Drawing.Point(62, 117);
|
||||||
|
this.TxtName.Name = "TxtName";
|
||||||
|
this.TxtName.Size = new System.Drawing.Size(130, 21);
|
||||||
|
this.TxtName.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// CmbGender
|
||||||
|
//
|
||||||
|
this.CmbGender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.CmbGender.FormattingEnabled = true;
|
||||||
|
this.CmbGender.Items.AddRange(new object[] {
|
||||||
|
"男",
|
||||||
|
"女"});
|
||||||
|
this.CmbGender.Location = new System.Drawing.Point(62, 158);
|
||||||
|
this.CmbGender.Name = "CmbGender";
|
||||||
|
this.CmbGender.Size = new System.Drawing.Size(130, 20);
|
||||||
|
this.CmbGender.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// LblGender
|
||||||
|
//
|
||||||
|
this.LblGender.AutoSize = true;
|
||||||
|
this.LblGender.Location = new System.Drawing.Point(21, 160);
|
||||||
|
this.LblGender.Name = "LblGender";
|
||||||
|
this.LblGender.Size = new System.Drawing.Size(35, 12);
|
||||||
|
this.LblGender.TabIndex = 0;
|
||||||
|
this.LblGender.Text = "性别:";
|
||||||
|
//
|
||||||
|
// LblAge
|
||||||
|
//
|
||||||
|
this.LblAge.AutoSize = true;
|
||||||
|
this.LblAge.Location = new System.Drawing.Point(21, 203);
|
||||||
|
this.LblAge.Name = "LblAge";
|
||||||
|
this.LblAge.Size = new System.Drawing.Size(35, 12);
|
||||||
|
this.LblAge.TabIndex = 0;
|
||||||
|
this.LblAge.Text = "年龄:";
|
||||||
|
//
|
||||||
|
// TxtAge
|
||||||
|
//
|
||||||
|
this.TxtAge.Location = new System.Drawing.Point(62, 198);
|
||||||
|
this.TxtAge.Name = "TxtAge";
|
||||||
|
this.TxtAge.Size = new System.Drawing.Size(130, 21);
|
||||||
|
this.TxtAge.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// LblLocation
|
||||||
|
//
|
||||||
|
this.LblLocation.AutoSize = true;
|
||||||
|
this.LblLocation.Location = new System.Drawing.Point(21, 244);
|
||||||
|
this.LblLocation.Name = "LblLocation";
|
||||||
|
this.LblLocation.Size = new System.Drawing.Size(35, 12);
|
||||||
|
this.LblLocation.TabIndex = 0;
|
||||||
|
this.LblLocation.Text = "地区:";
|
||||||
|
//
|
||||||
|
// TxtLocation
|
||||||
|
//
|
||||||
|
this.TxtLocation.Location = new System.Drawing.Point(62, 239);
|
||||||
|
this.TxtLocation.Name = "TxtLocation";
|
||||||
|
this.TxtLocation.Size = new System.Drawing.Size(130, 21);
|
||||||
|
this.TxtLocation.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// FormMain
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = System.Drawing.Color.White;
|
||||||
|
this.ClientSize = new System.Drawing.Size(716, 348);
|
||||||
|
this.Controls.Add(this.CmbGender);
|
||||||
|
this.Controls.Add(this.TxtLocation);
|
||||||
|
this.Controls.Add(this.TxtAge);
|
||||||
|
this.Controls.Add(this.LblLocation);
|
||||||
|
this.Controls.Add(this.TxtName);
|
||||||
|
this.Controls.Add(this.LblAge);
|
||||||
|
this.Controls.Add(this.LblGender);
|
||||||
|
this.Controls.Add(this.LblName);
|
||||||
|
this.Controls.Add(this.BtnSearch);
|
||||||
|
this.Controls.Add(this.BtnQuery);
|
||||||
|
this.Controls.Add(this.LblKeyword);
|
||||||
|
this.Controls.Add(this.LblID);
|
||||||
|
this.Controls.Add(this.TxtKeyword);
|
||||||
|
this.Controls.Add(this.TxtID);
|
||||||
|
this.Controls.Add(this.LblText);
|
||||||
|
this.Controls.Add(this.BtnDelete);
|
||||||
|
this.Controls.Add(this.BtnUpdate);
|
||||||
|
this.Controls.Add(this.BtnRefresh);
|
||||||
|
this.Controls.Add(this.BtnCreate);
|
||||||
|
this.Controls.Add(this.dataGridView1);
|
||||||
|
this.Name = "FormMain";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.Text = "CodeFirst的SQLite EF示例程序";
|
||||||
|
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.DataGridView dataGridView1;
|
||||||
|
private System.Windows.Forms.Button BtnCreate;
|
||||||
|
private System.Windows.Forms.Button BtnRefresh;
|
||||||
|
private System.Windows.Forms.Button BtnUpdate;
|
||||||
|
private System.Windows.Forms.Button BtnDelete;
|
||||||
|
private System.Windows.Forms.Label LblText;
|
||||||
|
private System.Windows.Forms.TextBox TxtID;
|
||||||
|
private System.Windows.Forms.Label LblID;
|
||||||
|
private System.Windows.Forms.Button BtnQuery;
|
||||||
|
private System.Windows.Forms.TextBox TxtKeyword;
|
||||||
|
private System.Windows.Forms.Label LblKeyword;
|
||||||
|
private System.Windows.Forms.Button BtnSearch;
|
||||||
|
private System.Windows.Forms.Label LblName;
|
||||||
|
private System.Windows.Forms.TextBox TxtName;
|
||||||
|
private System.Windows.Forms.ComboBox CmbGender;
|
||||||
|
private System.Windows.Forms.Label LblGender;
|
||||||
|
private System.Windows.Forms.Label LblAge;
|
||||||
|
private System.Windows.Forms.TextBox TxtAge;
|
||||||
|
private System.Windows.Forms.Label LblLocation;
|
||||||
|
private System.Windows.Forms.TextBox TxtLocation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
214
SQLiteEFCodeFirstDemo/FormMain.cs
Normal file
214
SQLiteEFCodeFirstDemo/FormMain.cs
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
using SQLiteEFCodeFirstDemo.Models;
|
||||||
|
|
||||||
|
namespace SQLiteEFCodeFirstDemo
|
||||||
|
{
|
||||||
|
/*********************************
|
||||||
|
* CodeFirst模式下EF SQLite示例程序
|
||||||
|
*
|
||||||
|
* 参考链接:
|
||||||
|
*
|
||||||
|
* C#/.NET VS2017+ EF+SQLite.CodeFirst——真正实现CodeFirst
|
||||||
|
* https://blog.csdn.net/qq_34202873/article/details/85068877
|
||||||
|
*
|
||||||
|
* Sqlite:Code First模式
|
||||||
|
* https://blog.csdn.net/wucdsg/article/details/78895366
|
||||||
|
*
|
||||||
|
* SQLite 的 CodeFirst 模式
|
||||||
|
* https://www.cnblogs.com/hippieZhou/archive/2018/08/04/9420432.html
|
||||||
|
*
|
||||||
|
* 以SQLite作为数据库的CodeFirst模式开发及踩的坑
|
||||||
|
* https://blog.csdn.net/kindmb/article/details/102293986
|
||||||
|
*
|
||||||
|
* SQLite在XP下出现no such table异常与找不到SQLite.Interop.dll故障
|
||||||
|
* https://blog.csdn.net/kindmb/article/details/102328189
|
||||||
|
*
|
||||||
|
* Sqlite && EF Code FIRST 终极解决方案 2019.5.17#
|
||||||
|
* https://www.cnblogs.com/swobble/p/10881756.html
|
||||||
|
*
|
||||||
|
* SQLite CodeFirst、Migration 的趟坑过程
|
||||||
|
* https://blog.csdn.net/myinc/article/details/61953193
|
||||||
|
*
|
||||||
|
* 感谢以上文章原作者
|
||||||
|
*
|
||||||
|
********************************/
|
||||||
|
public partial class FormMain : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 默认构造
|
||||||
|
/// </summary>
|
||||||
|
public FormMain()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建按钮事件
|
||||||
|
/// </summary>
|
||||||
|
private void BtnCreate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (var db = new MyDatabase())
|
||||||
|
{
|
||||||
|
db.Users.Add(GetInputUserInfo());
|
||||||
|
int count = db.SaveChanges();
|
||||||
|
LblText.Text = $"{DateTime.Now},插入{count}条记录";
|
||||||
|
RefreshData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除按钮事件
|
||||||
|
/// </summary>
|
||||||
|
private void BtnDelete_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (var db = new MyDatabase())
|
||||||
|
{
|
||||||
|
var user = db.Users.FirstOrDefault(x => x.ID == int.Parse(TxtID.Text));
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
var result = db.Users.Remove(user);
|
||||||
|
int count = db.SaveChanges();
|
||||||
|
LblText.Text = $"{DateTime.Now}, 删除{count}条记录";
|
||||||
|
SetInputUserInfo(null);
|
||||||
|
RefreshData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找按钮事件
|
||||||
|
/// </summary>
|
||||||
|
private void BtnQuery_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (var db = new MyDatabase())
|
||||||
|
{
|
||||||
|
var user = db.Users.Find(int.Parse(TxtID.Text));
|
||||||
|
if (user == null)
|
||||||
|
LblText.Text = $"{DateTime.Now}, 未找到指定用户";
|
||||||
|
else
|
||||||
|
SetInputUserInfo(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新按钮事件
|
||||||
|
/// </summary>
|
||||||
|
private void BtnRefresh_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
RefreshData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 搜索按钮事件
|
||||||
|
/// </summary>
|
||||||
|
private void BtnSearch_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(TxtKeyword.Text))
|
||||||
|
return;
|
||||||
|
using (var db = new MyDatabase())
|
||||||
|
{
|
||||||
|
var users = db.Users.Where(x => x.Name.Contains(TxtKeyword.Text)).ToList();
|
||||||
|
LblText.Text = $"{DateTime.Now}, 查到{users.Count}条记录";
|
||||||
|
dataGridView1.DataSource = users;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新按钮事件
|
||||||
|
/// </summary>
|
||||||
|
private void BtnUpdate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (var db = new MyDatabase())
|
||||||
|
{
|
||||||
|
var user = GetInputUserInfo();
|
||||||
|
user.ID = int.Parse(TxtID.Text);
|
||||||
|
db.Users.Attach(user);
|
||||||
|
int count = db.SaveChanges();
|
||||||
|
LblText.Text = $"{DateTime.Now}, 修改{count}条记录";
|
||||||
|
RefreshData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 行选中时触发
|
||||||
|
/// </summary>
|
||||||
|
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.RowIndex >= 0)
|
||||||
|
{
|
||||||
|
// 更新左侧输入框
|
||||||
|
if (dataGridView1.DataSource is List<User> users)
|
||||||
|
SetInputUserInfo(users[e.RowIndex]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取输入框用户信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private User GetInputUserInfo()
|
||||||
|
{
|
||||||
|
return new User
|
||||||
|
{
|
||||||
|
Name = TxtName.Text,
|
||||||
|
Gender = CmbGender.Text,
|
||||||
|
Age = int.Parse(TxtAge.Text),
|
||||||
|
Location = TxtLocation.Text
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新数据
|
||||||
|
/// </summary>
|
||||||
|
private void RefreshData()
|
||||||
|
{
|
||||||
|
using (var db = new MyDatabase())
|
||||||
|
{
|
||||||
|
var users = db.Users.ToList();
|
||||||
|
dataGridView1.DataSource = users;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置输入框用户信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user"></param>
|
||||||
|
private void SetInputUserInfo(User user)
|
||||||
|
{
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
TxtID.Text = user.ID.ToString();
|
||||||
|
TxtName.Text = user.Name;
|
||||||
|
CmbGender.Text = user.Gender;
|
||||||
|
TxtAge.Text = user.Age.ToString();
|
||||||
|
TxtLocation.Text = user.Location;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TxtID.Text = string.Empty;
|
||||||
|
TxtName.Text = string.Empty;
|
||||||
|
CmbGender.SelectedIndex = 0;
|
||||||
|
TxtAge.Text = string.Empty;
|
||||||
|
TxtLocation.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 窗口加载事件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
RefreshData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
SQLiteEFCodeFirstDemo/FormMain.resx
Normal file
120
SQLiteEFCodeFirstDemo/FormMain.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
22
SQLiteEFCodeFirstDemo/Models/User.cs
Normal file
22
SQLiteEFCodeFirstDemo/Models/User.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace SQLiteEFCodeFirstDemo.Models
|
||||||
|
{
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("姓名"), StringLength(20)]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("年龄")]
|
||||||
|
public int Age { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("性别"), StringLength(3)]
|
||||||
|
public string Gender { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("地区"), StringLength(30)]
|
||||||
|
public string Location { get; set; }
|
||||||
|
}
|
||||||
|
}
|
30
SQLiteEFCodeFirstDemo/MyDatabase.cs
Normal file
30
SQLiteEFCodeFirstDemo/MyDatabase.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Data.Entity;
|
||||||
|
|
||||||
|
using SQLiteEFCodeFirstDemo.Models;
|
||||||
|
|
||||||
|
namespace SQLiteEFCodeFirstDemo
|
||||||
|
{
|
||||||
|
public class MyDatabase : DbContext
|
||||||
|
{
|
||||||
|
public MyDatabase()
|
||||||
|
: base("name=MyDatabase")
|
||||||
|
{
|
||||||
|
// 解决参数中使用相对路径导致无法创建数据库问题
|
||||||
|
// https://blog.csdn.net/kindmb/article/details/102328189
|
||||||
|
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
|
// 设定初始化器为自动迁移数据库到最新版本
|
||||||
|
Database.SetInitializer(new MigrateDatabaseToLatestVersion<MyDatabase, Configuration>());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
// 自动发现
|
||||||
|
//modelBuilder.Configurations.AddFromAssembly(typeof(MyDatabase).Assembly);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual DbSet<User> Users { get; set; }
|
||||||
|
}
|
||||||
|
}
|
68
SQLiteEFCodeFirstDemo/Program.cs
Normal file
68
SQLiteEFCodeFirstDemo/Program.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace SQLiteEFCodeFirstDemo
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 应用程序的主入口点。
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
private static void Main()
|
||||||
|
{
|
||||||
|
//设置应用程序处理异常方式:ThreadException处理
|
||||||
|
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||||
|
//处理UI线程异常
|
||||||
|
Application.ThreadException += Application_ThreadException;
|
||||||
|
//处理非UI线程异常
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new FormMain());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
string str = GetExceptionMsg(e.Exception, e.ToString());
|
||||||
|
MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
//LogManager.WriteLog(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
|
||||||
|
MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
//LogManager.WriteLog(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成自定义异常消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ex">异常对象</param>
|
||||||
|
/// <param name="backStr">备用异常消息:当ex为null时有效</param>
|
||||||
|
/// <returns>异常字符串文本</returns>
|
||||||
|
private static string GetExceptionMsg(Exception ex, string backStr)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("****************************异常文本****************************");
|
||||||
|
sb.AppendLine("【出现时间】:" + DateTime.Now.ToString());
|
||||||
|
if (ex != null)
|
||||||
|
{
|
||||||
|
sb.AppendLine("【异常类型】:" + ex.GetType().Name);
|
||||||
|
sb.AppendLine("【异常信息】:" + ex.Message);
|
||||||
|
#if DEBUG
|
||||||
|
sb.AppendLine("【堆栈调用】:" + ex.StackTrace);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.AppendLine("【未处理异常】:" + backStr);
|
||||||
|
}
|
||||||
|
sb.AppendLine("***************************************************************");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
35
SQLiteEFCodeFirstDemo/Properties/AssemblyInfo.cs
Normal file
35
SQLiteEFCodeFirstDemo/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// 有关程序集的一般信息由以下
|
||||||
|
// 控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("SQLiteEFCodeFirstDemo")]
|
||||||
|
[assembly: AssemblyDescription("CodeFirst的EF SQLite示例程序")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("SQLiteEFCodeFirstDemo")]
|
||||||
|
[assembly: AssemblyCopyright("©2020 jie65535")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||||
|
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||||
|
[assembly: Guid("a8a315f7-36c3-4812-9f09-ef13582e7f68")]
|
||||||
|
|
||||||
|
// 程序集的版本信息由下列四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
|
//通过使用 "*",如下所示:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
SQLiteEFCodeFirstDemo/Properties/Resources.Designer.cs
generated
Normal file
71
SQLiteEFCodeFirstDemo/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本: 4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能导致不正确的行为,如果
|
||||||
|
// 重新生成代码,则所做更改将丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace SQLiteEFCodeFirstDemo.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 强类型资源类,用于查找本地化字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 StronglyTypedResourceBuilder
|
||||||
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
|
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SQLiteEFCodeFirstDemo.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 覆盖当前线程的 CurrentUICulture 属性
|
||||||
|
/// 使用此强类型的资源类的资源查找。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
117
SQLiteEFCodeFirstDemo/Properties/Resources.resx
Normal file
117
SQLiteEFCodeFirstDemo/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
30
SQLiteEFCodeFirstDemo/Properties/Settings.Designer.cs
generated
Normal file
30
SQLiteEFCodeFirstDemo/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace SQLiteEFCodeFirstDemo.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
SQLiteEFCodeFirstDemo/Properties/Settings.settings
Normal file
7
SQLiteEFCodeFirstDemo/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
118
SQLiteEFCodeFirstDemo/SQLiteEFCodeFirstDemo.csproj
Normal file
118
SQLiteEFCodeFirstDemo/SQLiteEFCodeFirstDemo.csproj
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{A8A315F7-36C3-4812-9F09-EF13582E7F68}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>SQLiteEFCodeFirstDemo</RootNamespace>
|
||||||
|
<AssemblyName>SQLiteEFCodeFirstDemo</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data.SQLite, Version=1.0.113.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Data.SQLite.Core.1.0.113.1\lib\net451\System.Data.SQLite.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.SQLite.EF6, Version=1.0.113.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Data.SQLite.EF6.1.0.113.0\lib\net451\System.Data.SQLite.EF6.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.SQLite.EF6.Migrations, Version=1.0.112.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Data.SQLite.EF6.Migrations.1.0.112\lib\System.Data.SQLite.EF6.Migrations.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.SQLite.Linq, Version=1.0.113.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Data.SQLite.Linq.1.0.113.0\lib\net451\System.Data.SQLite.Linq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.Security" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Configuration.cs" />
|
||||||
|
<Compile Include="FormMain.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="FormMain.Designer.cs">
|
||||||
|
<DependentUpon>FormMain.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Models\User.cs" />
|
||||||
|
<Compile Include="MyDatabase.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<EmbeddedResource Include="FormMain.resx">
|
||||||
|
<DependentUpon>FormMain.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
|
||||||
|
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.113.1\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.113.1\build\net451\System.Data.SQLite.Core.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
|
||||||
|
<Import Project="..\packages\System.Data.SQLite.Core.1.0.113.1\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.113.1\build\net451\System.Data.SQLite.Core.targets')" />
|
||||||
|
</Project>
|
9
SQLiteEFCodeFirstDemo/packages.config
Normal file
9
SQLiteEFCodeFirstDemo/packages.config
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||||
|
<package id="System.Data.SQLite" version="1.0.113.1" targetFramework="net452" />
|
||||||
|
<package id="System.Data.SQLite.Core" version="1.0.113.1" targetFramework="net452" />
|
||||||
|
<package id="System.Data.SQLite.EF6" version="1.0.113.0" targetFramework="net452" />
|
||||||
|
<package id="System.Data.SQLite.EF6.Migrations" version="1.0.112" targetFramework="net452" />
|
||||||
|
<package id="System.Data.SQLite.Linq" version="1.0.113.0" targetFramework="net452" />
|
||||||
|
</packages>
|
Loading…
Reference in New Issue
Block a user