-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added migration and initialized DBContext in Global.asax
- Loading branch information
Showing
10 changed files
with
88 additions
and
97 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...ud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/Migrations/Configuration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace StudentsSystem.Data.Migrations | ||
{ | ||
using System.Data.Entity.Migrations; | ||
|
||
public sealed class Configuration : DbMigrationsConfiguration<StudentsSystemDbContext> | ||
{ | ||
public Configuration() | ||
{ | ||
this.AutomaticMigrationsEnabled = true; | ||
this.AutomaticMigrationDataLossAllowed = true; | ||
} | ||
|
||
protected override void Seed(StudentsSystemDbContext context) | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ public static StudentsSystemDbContext Create() | |
return new StudentsSystemDbContext(); | ||
} | ||
} | ||
} | ||
} |
9 changes: 1 addition & 8 deletions
9
...ices And Cloud/02.ASP.NET Web API/StudentsSystem/Data/StudentsSystem.Data/packages.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="EntityFramework" version="6.1.0" targetFramework="net451" /> | ||
<package id="EntityFramework" version="6.1.3" targetFramework="net451" /> | ||
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net451" /> | ||
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net451" /> | ||
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net451" /> | ||
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net451" /> | ||
<package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net451" /> | ||
<package id="Microsoft.Owin.Security.Cookies" version="2.1.0" targetFramework="net451" /> | ||
<package id="Microsoft.Owin.Security.OAuth" version="2.1.0" targetFramework="net451" /> | ||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net451" /> | ||
<package id="Owin" version="1.0" targetFramework="net451" /> | ||
</packages> |
15 changes: 15 additions & 0 deletions
15
...d/02.ASP.NET Web API/StudentsSystem/Server/StudentsSystem.Api/App_Start/DatabaseConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace StudentsSystem.Api | ||
{ | ||
using System.Data.Entity; | ||
|
||
using Data; | ||
using Data.Migrations; | ||
|
||
public static class DatabaseConfig | ||
{ | ||
public static void Initialize() | ||
{ | ||
Database.SetInitializer(new MigrateDatabaseToLatestVersion<StudentsSystemDbContext, Configuration>()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 35 additions & 43 deletions
78
...Services And Cloud/02.ASP.NET Web API/StudentsSystem/Server/StudentsSystem.Api/Web.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,87 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
For more information on how to configure your ASP.NET application, please visit | ||
http://go.microsoft.com/fwlink/?LinkId=301879 | ||
--> | ||
<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"/> | ||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | ||
</configSections> | ||
<connectionStrings> | ||
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=StudentsSystem;Integrated Security=True" | ||
providerName="System.Data.SqlClient" /> | ||
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=StudentsSystem;Integrated Security=True" providerName="System.Data.SqlClient" /> | ||
</connectionStrings> | ||
<appSettings></appSettings> | ||
<system.web> | ||
<authentication mode="None"/> | ||
<compilation debug="true" targetFramework="4.5.1"/> | ||
<httpRuntime targetFramework="4.5.1"/> | ||
<authentication mode="None" /> | ||
<compilation debug="true" targetFramework="4.5.1" /> | ||
<httpRuntime targetFramework="4.5.1" /> | ||
</system.web> | ||
<system.webServer> | ||
<modules> | ||
<remove name="FormsAuthentication"/> | ||
<remove name="FormsAuthentication" /> | ||
</modules> | ||
<handlers> | ||
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/> | ||
<remove name="OPTIONSVerbHandler"/> | ||
<remove name="TRACEVerbHandler"/> | ||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" | ||
preCondition="integratedMode,runtimeVersionv4.0"/> | ||
<remove name="ExtensionlessUrlHandler-Integrated-4.0" /> | ||
<remove name="OPTIONSVerbHandler" /> | ||
<remove name="TRACEVerbHandler" /> | ||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> | ||
</handlers> | ||
</system.webServer> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-3.0.1.0" newVersion="3.0.1.0"/> | ||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-3.0.1.0" newVersion="3.0.1.0"/> | ||
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-3.0.1.0" newVersion="3.0.1.0"/> | ||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-3.0.1.0" newVersion="3.0.1.0"/> | ||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/> | ||
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/> | ||
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/> | ||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> | ||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/> | ||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/> | ||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> | ||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
<entityFramework> | ||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/> | ||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> | ||
<providers> | ||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> | ||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> | ||
</providers> | ||
</entityFramework> | ||
<system.codedom> | ||
<compilers> | ||
<compiler language="c#;cs;csharp" extension=".cs" | ||
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" | ||
warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/> | ||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" | ||
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" | ||
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/> | ||
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> | ||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /> | ||
</compilers> | ||
</system.codedom> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters