diff --git a/ASP.Net Core/MVCBasics/Controllers/AboutController.cs b/ASP.Net Core/MVCBasics/Controllers/AboutController.cs
index 2ed65a6..c2fd469 100644
--- a/ASP.Net Core/MVCBasics/Controllers/AboutController.cs
+++ b/ASP.Net Core/MVCBasics/Controllers/AboutController.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc;
-namespace test.Controllers
+namespace EntityFrameworkBasics.Controllers
{
public class AboutController : Controller
{
diff --git a/ASP.Net Core/MVCBasics/Controllers/HomeController.cs b/ASP.Net Core/MVCBasics/Controllers/HomeController.cs
index cdc156c..462180b 100644
--- a/ASP.Net Core/MVCBasics/Controllers/HomeController.cs
+++ b/ASP.Net Core/MVCBasics/Controllers/HomeController.cs
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using System;
-namespace test.Controllers
+namespace EntityFrameworkBasics.Controllers
{
public class HomeController : Controller
{
diff --git a/ASP.Net Core/MVCBasics/Data/ApplicationDBContext.cs b/ASP.Net Core/MVCBasics/Data/ApplicationDBContext.cs
new file mode 100644
index 0000000..ddd47e1
--- /dev/null
+++ b/ASP.Net Core/MVCBasics/Data/ApplicationDBContext.cs
@@ -0,0 +1,39 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace EntityFrameworkBasics
+{
+ ///
+ /// The database representational model for application
+ ///
+ public class ApplicationDBContext : DbContext
+ {
+ #region Public properties
+
+ public DbSet Settings { get; set; }
+
+ #endregion
+
+ public ApplicationDBContext()
+ {
+
+ }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ base.OnConfiguring(optionsBuilder);
+ // tfoUbuntu;User ID=sa;Password=********;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
+ //optionsBuilder.UseSqlServer("Server=192.168.0.135;Database=entityframework;")
+ optionsBuilder.UseSqlServer("Server=192.168.0.135;Database=entityframework;User ID=sa;Password=SAtfoubuntu1SA;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;MultipleActiveResultSets=true;");
+ }
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+
+ }
+ }
+}
diff --git a/ASP.Net Core/MVCBasics/Data/SettingsDataModel.cs b/ASP.Net Core/MVCBasics/Data/SettingsDataModel.cs
new file mode 100644
index 0000000..196736f
--- /dev/null
+++ b/ASP.Net Core/MVCBasics/Data/SettingsDataModel.cs
@@ -0,0 +1,21 @@
+namespace EntityFrameworkBasics
+{
+ ///
+ /// Our Settings database table representional model
+ ///
+ public class SettingsDataModel
+ {
+ ///
+ /// The unique Id for this entry
+ ///
+ public string Id { get; set; }
+ ///
+ /// The settings name
+ ///
+ public string Name { get; set; }
+ ///
+ /// The settings value
+ ///
+ public string Value { get; set; }
+ }
+}
diff --git a/ASP.Net Core/MVCBasics/test.csproj b/ASP.Net Core/MVCBasics/EntityFrameworkBasics.csproj
similarity index 100%
rename from ASP.Net Core/MVCBasics/test.csproj
rename to ASP.Net Core/MVCBasics/EntityFrameworkBasics.csproj
diff --git a/ASP.Net Core/MVCBasics/Program.cs b/ASP.Net Core/MVCBasics/Program.cs
index 65b46d0..4e98cab 100644
--- a/ASP.Net Core/MVCBasics/Program.cs
+++ b/ASP.Net Core/MVCBasics/Program.cs
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Hosting;
using System.IO;
-namespace test
+namespace EntityFrameworkBasics
{
public class Program
{
diff --git a/ASP.Net Core/MVCBasics/Startup.cs b/ASP.Net Core/MVCBasics/Startup.cs
index df6aabc..7ceb72a 100644
--- a/ASP.Net Core/MVCBasics/Startup.cs
+++ b/ASP.Net Core/MVCBasics/Startup.cs
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-namespace test
+namespace EntityFrameworkBasics
{
public class Startup
{
@@ -21,6 +21,11 @@ namespace test
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
+ using(var context = new ApplicationDBContext())
+ {
+ context.Database.EnsureCreated();
+ }
+
services.AddMvc();
}
diff --git a/ASP.Net Core/MVCBasics/Views/_ViewImports.cshtml b/ASP.Net Core/MVCBasics/Views/_ViewImports.cshtml
index c9d2285..f547c19 100644
--- a/ASP.Net Core/MVCBasics/Views/_ViewImports.cshtml
+++ b/ASP.Net Core/MVCBasics/Views/_ViewImports.cshtml
@@ -1,2 +1,2 @@
-@using test
+@using EntityFrameworkBasics
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
diff --git a/ASP.Net Core/MVCBasics/test.sln b/ASP.Net Core/MVCBasics/test.sln
index 7094101..dadab2a 100644
--- a/ASP.Net Core/MVCBasics/test.sln
+++ b/ASP.Net Core/MVCBasics/test.sln
@@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27130.2010
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29509.3
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test", "test.csproj", "{B6C91DFF-E4A2-4DD3-A357-F8BECCCA183A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkBasics", "EntityFrameworkBasics.csproj", "{B6C91DFF-E4A2-4DD3-A357-F8BECCCA183A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution