From e9a7f4f3f75f28bafc3fceb18c9c0bb877a36e11 Mon Sep 17 00:00:00 2001 From: nikolavn Date: Mon, 2 Nov 2015 10:22:08 +0200 Subject: [PATCH] Added migration and initialized DBContext in Global.asax --- .../Migrations/Configuration.cs | 18 +++++ .../Properties/AssemblyInfo.cs | 2 +- .../StudentsSystem.Data.csproj | 45 +++-------- .../StudentsSystemDbContext.cs | 2 +- .../Data/StudentsSystem.Data/packages.config | 9 +-- .../App_Start/DatabaseConfig.cs | 15 ++++ .../Server/StudentsSystem.Api/Global.asax.cs | 1 + .../StudentsSystem.Api.csproj | 3 +- .../Server/StudentsSystem.Api/Web.config | 78 +++++++++---------- .../StudentsSystem/StudentsSystem.sln | 12 +-- 10 files changed, 88 insertions(+), 97 deletions(-) create mode 100644 Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Migrations/Configuration.cs create mode 100644 Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Server/StudentsSystem.Api/App_Start/DatabaseConfig.cs diff --git a/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Migrations/Configuration.cs b/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Migrations/Configuration.cs new file mode 100644 index 0000000..38757a6 --- /dev/null +++ b/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Migrations/Configuration.cs @@ -0,0 +1,18 @@ +namespace StudentsSystem.Data.Migrations +{ + using System.Data.Entity.Migrations; + + public sealed class Configuration : DbMigrationsConfiguration + { + public Configuration() + { + this.AutomaticMigrationsEnabled = true; + this.AutomaticMigrationDataLossAllowed = true; + } + + protected override void Seed(StudentsSystemDbContext context) + { + + } + } +} diff --git a/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Properties/AssemblyInfo.cs b/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Properties/AssemblyInfo.cs index d2e38d5..6a826cd 100644 --- a/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Properties/AssemblyInfo.cs +++ b/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5ad94ef4-d85d-4ee2-8c01-3172113ebb70")] +[assembly: Guid("fd0bc334-11fc-4236-98dd-6f6a8b21b2e6")] // Version information for an assembly consists of the following four values: // diff --git a/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/StudentsSystem.Data.csproj b/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/StudentsSystem.Data.csproj index 4f84c7d..9ade427 100644 --- a/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/StudentsSystem.Data.csproj +++ b/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/StudentsSystem.Data.csproj @@ -4,7 +4,7 @@ Debug AnyCPU - {5AD94EF4-D85D-4EE2-8C01-3172113EBB70} + {FD0BC334-11FC-4236-98DD-6F6A8B21B2E6} Library Properties StudentsSystem.Data @@ -31,11 +31,11 @@ - ..\..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.dll + ..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll True - ..\..\packages\EntityFramework.6.1.0\lib\net45\EntityFramework.SqlServer.dll + ..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll True @@ -46,34 +46,6 @@ ..\..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll True - - ..\..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll - True - - - ..\..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll - True - - - ..\..\packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll - True - - - ..\..\packages\Microsoft.Owin.Security.Cookies.2.1.0\lib\net45\Microsoft.Owin.Security.Cookies.dll - True - - - ..\..\packages\Microsoft.Owin.Security.OAuth.2.1.0\lib\net45\Microsoft.Owin.Security.OAuth.dll - True - - - ..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll - True - - - ..\..\packages\Owin.1.0\lib\net40\Owin.dll - True - @@ -85,12 +57,9 @@ - + - - - - + @@ -98,6 +67,10 @@ StudentsSystem.Models + + + + -
+
- + - - - + + + - + - - - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + \ No newline at end of file diff --git a/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/StudentsSystem.sln b/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/StudentsSystem.sln index 6f87f36..5b55a6f 100644 --- a/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/StudentsSystem.sln +++ b/Web Services And Cloud/02.ASP.NET Web API/StudentsSystem/StudentsSystem.sln @@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{5A4C5DB6-B EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentsSystem.Models", "Data\StudentsSystem.Models\StudentsSystem.Models.csproj", "{434BD4E0-93E7-4309-A987-A82AB08466C1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentsSystem.Data", "Data\StudentsSystem.Data\StudentsSystem.Data.csproj", "{5AD94EF4-D85D-4EE2-8C01-3172113EBB70}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentsSystem.Data", "Data\StudentsSystem.Data\StudentsSystem.Data.csproj", "{FD0BC334-11FC-4236-98DD-6F6A8B21B2E6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,10 +27,10 @@ Global {434BD4E0-93E7-4309-A987-A82AB08466C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {434BD4E0-93E7-4309-A987-A82AB08466C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {434BD4E0-93E7-4309-A987-A82AB08466C1}.Release|Any CPU.Build.0 = Release|Any CPU - {5AD94EF4-D85D-4EE2-8C01-3172113EBB70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5AD94EF4-D85D-4EE2-8C01-3172113EBB70}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5AD94EF4-D85D-4EE2-8C01-3172113EBB70}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5AD94EF4-D85D-4EE2-8C01-3172113EBB70}.Release|Any CPU.Build.0 = Release|Any CPU + {FD0BC334-11FC-4236-98DD-6F6A8B21B2E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD0BC334-11FC-4236-98DD-6F6A8B21B2E6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD0BC334-11FC-4236-98DD-6F6A8B21B2E6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD0BC334-11FC-4236-98DD-6F6A8B21B2E6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -38,6 +38,6 @@ Global GlobalSection(NestedProjects) = preSolution {659815C0-373A-4B84-A5B3-E942C62697BC} = {6A8B07C7-229F-4428-AF38-BC329A9632AC} {434BD4E0-93E7-4309-A987-A82AB08466C1} = {5A4C5DB6-B033-44E5-AF32-6709ED65EA1D} - {5AD94EF4-D85D-4EE2-8C01-3172113EBB70} = {5A4C5DB6-B033-44E5-AF32-6709ED65EA1D} + {FD0BC334-11FC-4236-98DD-6F6A8B21B2E6} = {5A4C5DB6-B033-44E5-AF32-6709ED65EA1D} EndGlobalSection EndGlobal