From 44a80e084c264296cb559d8ce1e544774c4c18aa Mon Sep 17 00:00:00 2001
From: wells.liu <wells.liu@broconcentric.com>
Date: 星期二, 07 七月 2020 16:53:22 +0800
Subject: [PATCH] 解决数据迁移问题

---
 src/Bro.M071.Model/App.config                                    |    2 
 src/Bro.UI.Config/App.config                                     |   34 ++++++
 src/Bro.M071.Model/Migrations/202007070851439_initDB.cs          |   92 ++++++++++++++++++
 src/Bro.M071.Model/Migrations/202007070851439_initDB.resx        |  126 +++++++++++++++++++++++++
 src/Bro.M071.Model/Migrations/202007070851439_initDB.Designer.cs |   29 +++++
 src/Bro.M071.Model/Bro.M071.Model.csproj                         |   11 ++
 6 files changed, 292 insertions(+), 2 deletions(-)

diff --git a/src/Bro.M071.Model/App.config b/src/Bro.M071.Model/App.config
index 274ca45..2dba76c 100644
--- a/src/Bro.M071.Model/App.config
+++ b/src/Bro.M071.Model/App.config
@@ -38,6 +38,6 @@
     </assemblyBinding>
   </runtime>
   <startup>
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
   </startup>
 </configuration>
\ No newline at end of file
diff --git a/src/Bro.M071.Model/Bro.M071.Model.csproj b/src/Bro.M071.Model/Bro.M071.Model.csproj
index ec2c1db..7f549d8 100644
--- a/src/Bro.M071.Model/Bro.M071.Model.csproj
+++ b/src/Bro.M071.Model/Bro.M071.Model.csproj
@@ -108,6 +108,10 @@
   <ItemGroup>
     <Compile Include="BaseModel.cs" />
     <Compile Include="DBModel.cs" />
+    <Compile Include="Migrations\202007070851439_initDB.cs" />
+    <Compile Include="Migrations\202007070851439_initDB.designer.cs">
+      <DependentUpon>202007070851439_initDB.cs</DependentUpon>
+    </Compile>
     <Compile Include="Migrations\Configuration.cs" />
     <Compile Include="Model\KeyUnitData.cs" />
     <Compile Include="Model\MeasurementUnitResult.cs" />
@@ -127,5 +131,10 @@
       <Name>Bro.Common.Model</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Migrations\202007070851439_initDB.resx">
+      <DependentUpon>202007070851439_initDB.cs</DependentUpon>
+    </EmbeddedResource>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- </Project>
\ No newline at end of file
+</Project>
\ No newline at end of file
diff --git a/src/Bro.M071.Model/Migrations/202007070851439_initDB.Designer.cs b/src/Bro.M071.Model/Migrations/202007070851439_initDB.Designer.cs
new file mode 100644
index 0000000..779cd8c
--- /dev/null
+++ b/src/Bro.M071.Model/Migrations/202007070851439_initDB.Designer.cs
@@ -0,0 +1,29 @@
+锘�// <auto-generated />
+namespace Bro.M071.Model.Migrations
+{
+    using System.CodeDom.Compiler;
+    using System.Data.Entity.Migrations;
+    using System.Data.Entity.Migrations.Infrastructure;
+    using System.Resources;
+    
+    [GeneratedCode("EntityFramework.Migrations", "6.4.0")]
+    public sealed partial class initDB : IMigrationMetadata
+    {
+        private readonly ResourceManager Resources = new ResourceManager(typeof(initDB));
+        
+        string IMigrationMetadata.Id
+        {
+            get { return "202007070851439_initDB"; }
+        }
+        
+        string IMigrationMetadata.Source
+        {
+            get { return null; }
+        }
+        
+        string IMigrationMetadata.Target
+        {
+            get { return Resources.GetString("Target"); }
+        }
+    }
+}
diff --git a/src/Bro.M071.Model/Migrations/202007070851439_initDB.cs b/src/Bro.M071.Model/Migrations/202007070851439_initDB.cs
new file mode 100644
index 0000000..01e4879
--- /dev/null
+++ b/src/Bro.M071.Model/Migrations/202007070851439_initDB.cs
@@ -0,0 +1,92 @@
+锘縩amespace Bro.M071.Model.Migrations
+{
+    using System;
+    using System.Data.Entity.Migrations;
+    
+    public partial class initDB : DbMigration
+    {
+        public override void Up()
+        {
+            CreateTable(
+                "dbo.KeyUnitData",
+                c => new
+                    {
+                        ID = c.String(nullable: false, maxLength: 64),
+                        ProductionMeasurementRecordsId = c.String(maxLength: 64),
+                        Key = c.String(maxLength: 64),
+                        MeasurementItem = c.String(maxLength: 64),
+                        ItemValue = c.String(maxLength: 64),
+                        IS_DISABLED = c.Int(nullable: false),
+                        IS_DELETED = c.Int(nullable: false),
+                        CREATE_USER = c.String(maxLength: 64),
+                        CREATE_TIME = c.DateTime(nullable: false),
+                        UPDATE_USER = c.String(maxLength: 64),
+                        UPDATE_TIME = c.DateTime(),
+                    })
+                .PrimaryKey(t => t.ID);
+            
+            CreateTable(
+                "dbo.MeasurementAndKeyDataRelation",
+                c => new
+                    {
+                        ID = c.String(nullable: false, maxLength: 64),
+                        KeyUnitDataId = c.String(maxLength: 64),
+                        MeasurementUnitResultId = c.String(maxLength: 64),
+                        IS_DISABLED = c.Int(nullable: false),
+                        IS_DELETED = c.Int(nullable: false),
+                        CREATE_USER = c.String(maxLength: 64),
+                        CREATE_TIME = c.DateTime(nullable: false),
+                        UPDATE_USER = c.String(maxLength: 64),
+                        UPDATE_TIME = c.DateTime(),
+                    })
+                .PrimaryKey(t => t.ID);
+            
+            CreateTable(
+                "dbo.MeasurementUnitResult",
+                c => new
+                    {
+                        ID = c.String(nullable: false, maxLength: 64),
+                        ProductionMeasurementRecordsId = c.String(maxLength: 64),
+                        MeasurementName = c.String(maxLength: 64),
+                        MeasurementType = c.String(maxLength: 64),
+                        MeasurementValue = c.String(maxLength: 64),
+                        MeasurementResult = c.String(maxLength: 64),
+                        IS_DISABLED = c.Int(nullable: false),
+                        IS_DELETED = c.Int(nullable: false),
+                        CREATE_USER = c.String(maxLength: 64),
+                        CREATE_TIME = c.DateTime(nullable: false),
+                        UPDATE_USER = c.String(maxLength: 64),
+                        UPDATE_TIME = c.DateTime(),
+                    })
+                .PrimaryKey(t => t.ID);
+            
+            CreateTable(
+                "dbo.ProductionMeasurementRecords",
+                c => new
+                    {
+                        ID = c.String(nullable: false, maxLength: 64),
+                        ProductionCode = c.String(maxLength: 64),
+                        ProductionBarcode = c.String(maxLength: 64),
+                        ProductionResult = c.String(maxLength: 64),
+                        OperationStartTime = c.DateTime(nullable: false),
+                        OperationEndTime = c.DateTime(nullable: false),
+                        IS_DISABLED = c.Int(nullable: false),
+                        IS_DELETED = c.Int(nullable: false),
+                        CREATE_USER = c.String(maxLength: 64),
+                        CREATE_TIME = c.DateTime(nullable: false),
+                        UPDATE_USER = c.String(maxLength: 64),
+                        UPDATE_TIME = c.DateTime(),
+                    })
+                .PrimaryKey(t => t.ID);
+            
+        }
+        
+        public override void Down()
+        {
+            DropTable("dbo.ProductionMeasurementRecords");
+            DropTable("dbo.MeasurementUnitResult");
+            DropTable("dbo.MeasurementAndKeyDataRelation");
+            DropTable("dbo.KeyUnitData");
+        }
+    }
+}
diff --git a/src/Bro.M071.Model/Migrations/202007070851439_initDB.resx b/src/Bro.M071.Model/Migrations/202007070851439_initDB.resx
new file mode 100644
index 0000000..6b09195
--- /dev/null
+++ b/src/Bro.M071.Model/Migrations/202007070851439_initDB.resx
@@ -0,0 +1,126 @@
+锘�<?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>
+  <data name="Target" xml:space="preserve">
+    <value>H4sIAAAAAAAEAO1c227bOBB9X2D/QdBzaiXpYi9Zu0V8SeFu3GQtu08FCloaO8JKlCFSQfxt+7CftL+wpK7U1ZIsuZcVAjQVZ3hmSHEOqeEg//79z/Dti2VKz+AQw8Yj+WpwKUuANVs38G4ku3T76lf57ZsffxjOdOtF+hjqveZ6rCcmI/mJ0v2NohDtCSxEBpahOTaxt3Sg2ZaCdFu5vrz8Tbm6UoBByAxLkoZLF1PDAu+BPU5srMGeushc2DqYJGh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nVDYqnEdopYRFEjiknmrwuoJqnU00RPE0l51zQhnDvboYdiwHq0UIbzPZ1pMpnnAqLwhY1w/RRzAa4vbISbc+TJShshh19CBdD5H0qlK6Ony54um9Jl6Rf0CaxZB7cCedaD65pD/cRvPmf6siaoUYI3HzgSN8HOI52stDpyXtZWxM6TN0CPEri52JG058qeK5PyE7gykylMq0TWo4xhKjM4DLJ0x2uNM2k7X0WW2EQ9GzpP2akHQsEacIWB+ue9QSGWLhA2tkCof+8m60xHIrbrMOjpzafH5cP72WSlfuK0/IkDjJkF72mgb34fGxg5h3fr+XR05yfYE5XOX0/VsUKIblYvPT77zSN+Zsz8hJzMJUYnVSIVrNWs4m0JsaBotyX0TI1uW7jZqz0D0xYu9pqg5FzrtTTMnFs8xhZAW7rFa8nLnEu7PC+zUC0V336z1JFbxtp+XOdVrfZx2MfhSXFYlAz7luLvrFt3QT1n++hi+Wb76F3s5oXFmT1L9SxVn6WqZ52+TbISCxhbeimF9Yqt43cS4MXViI0DoKgasTFgT0LfPwml6w6z9V0F2f361YV+yom5vbHZCHx3v2D5YZ47X7Ri8YhDX6q4Mc+tTsohs8nMoSL+eYXhFIixiyH4H1vA4HkRg4Y6c7y1wwhiEyN6FKpkjnQU8cTmrUONLdIoE2tAiFc07B0hR/LM2oA+xw8u3bv0lhCwNmaidm6olNv3aj6TPg8f9vyJtDEE5qbBSeEBj13D1CO/77LUVQTB4/8d4GhzYr9hd4iQPti4IlAwfVPYA9b5GR+sPYsjIA9YRc/QxLc1gXvYIe0QpqWLQY6/iOS0D6cG2jnIIgFG3J89sjWsWy9v/gNA/V6hZUQAAA==</value>
+  </data>
+  <data name="DefaultSchema" xml:space="preserve">
+    <value>dbo</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/src/Bro.UI.Config/App.config b/src/Bro.UI.Config/App.config
index 208a5c1..b5c8db5 100644
--- a/src/Bro.UI.Config/App.config
+++ b/src/Bro.UI.Config/App.config
@@ -1,5 +1,39 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
 <configuration>
+  <configSections>
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <entityFramework>
+    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+    <providers>
+      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
+      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
+      <!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />-->
+    </providers>
+  </entityFramework>
+  <connectionStrings>
+    <add name="DataBase" connectionString="data source=D:\PROJECTS\M071\DataBase\M071.db;BinaryGUID=False" providerName="System.Data.SQLite" />
+  </connectionStrings>
+  <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>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Data.SQLite.EF6" publicKeyToken="db937bc2d44ff139" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
   <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
   </startup>

--
Gitblit v1.8.0