Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect to SQLDB in Azure #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace DotNetCoreSqlDb.Migrations
Expand All @@ -13,8 +12,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
columns: table => new
{
ID = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
.Annotation("SqlServer:Identity", "1, 1"),
Description = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false)
},
Expand Down
12 changes: 8 additions & 4 deletions Migrations/MyDatabaseContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using DotNetCoreSqlDb.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace DotNetCoreSqlDb.Migrations
Expand All @@ -14,19 +15,22 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.3");
.HasAnnotation("ProductVersion", "3.1.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

modelBuilder.Entity("DotNetCoreSqlDb.Models.Todo", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

b.Property<DateTime>("CreatedDate")
.HasColumnType("TEXT");
.HasColumnType("datetime2");

b.Property<string>("Description")
.HasColumnType("TEXT");
.HasColumnType("nvarchar(max)");

b.HasKey("ID");

Expand Down
3 changes: 2 additions & 1 deletion Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddDbContext<MyDatabaseContext>(options =>
options.UseSqlite("Data Source=localdatabase.db"));
// options.UseSqlite("Data Source=localdatabase.db"));
options.UseSqlServer(Configuration.GetConnectionString("MyDbConnection")));
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down
Binary file added localdatabase.db
Binary file not shown.