Skip to content

Commit

Permalink
⬆️ Update docs to Beta 7
Browse files Browse the repository at this point in the history
Updating docs and samples to Beta 7 - except for cross-plat ones which
will come in a separate commit.
Note that UWP is currently broken on Beta 7, so adding docs to use Beta
6 for the moment.
  • Loading branch information
rowanmiller committed Sep 1, 2015
1 parent 8ad0698 commit e4ec46e
Show file tree
Hide file tree
Showing 24 changed files with 286 additions and 284 deletions.
20 changes: 10 additions & 10 deletions docs/getting-started/aspnet5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ In this article:
`View this article's samples on GitHub <https://github.com/aspnet/EntityFramework.Docs/tree/master/docs/getting-started/aspnet5/sample>`_.

.. note::
This walkthrough uses EF 7.0.0-beta6 which is the latest pre-release available on NuGet.org.
This walkthrough uses EF 7.0.0-beta7 which is the latest pre-release available on NuGet.org.

You can find nightly builds of the EF7 code base hosted on https://www.myget.org/F/aspnetvnext/api/v2/ but the code base is rapidly changing and we do not maintain up-to-date documentation for getting started.

Expand All @@ -39,8 +39,8 @@ Create a new project
- Enter **EFGetStarted.AspNet5** as the name and click **OK**

When the **New ASP.NET Project** dialog appears:
- Under **ASP.NET 5 Preview Templates** select **Web Site**
- Ensure that **Authentication** is set to **None**
- Under **ASP.NET 5 Preview Templates** select **Web Application**
- Ensure that **Authentication** is set to **No Authentication**
- Click **OK**

.. caution::
Expand Down Expand Up @@ -77,7 +77,7 @@ Now it's time to define a context and entity classes that make up your model.
- Right-click on the project in **Solution Explorer** and select :menuselection:`Add --> New Folder`
- Enter **Models** as the name of the folder
- Right-click on the **Models** folder and select :menuselection:`Add --> New Item...`
- From the left menu select :menuselection:`Installed --> ASP.NET 5`
- From the left menu select :menuselection:`Installed --> Server-side`
- Select the **Class** item template
- Enter **BloggingModel.cs** as the name and click **OK**
- Replace the contents of the file with the following code
Expand All @@ -101,7 +101,7 @@ In order for our MVC controllers to make use of ``BloggingContext`` we are going
.. literalinclude:: aspnet5/sample/src/EFGetStarted.AspNet5/Startup.cs
:language: c#
:linenos:
:lines: 15-16
:lines: 11-12

Now we can use the ``AddDbContext`` method to register it as a service.
- Locate the ``ConfigureServices`` method
Expand All @@ -110,7 +110,7 @@ Now we can use the ``AddDbContext`` method to register it as a service.
.. literalinclude:: aspnet5/sample/src/EFGetStarted.AspNet5/Startup.cs
:language: c#
:linenos:
:lines: 33-42
:lines: 29-38
:emphasize-lines: 4-8

Create your database
Expand All @@ -123,12 +123,12 @@ Create your database
Now that you have a model, you can use migrations to create a database for you.
- Open a command prompt (**Windows Key + R**, type **cmd**, click **OK**)
- Use the ``cd`` command to navigate to the project directory
- Run ``dnvm use 1.0.0-beta6``
- Run ``dnx . ef migration add MyFirstMigration`` to scaffold a migration to create the initial set of tables for your model.
- Run ``dnx . ef migration apply`` to apply the new migration to the database. Because your database doesn't exist yet, it will be created for you before the migration is applied.
- Run ``dnvm use 1.0.0-beta7``
- Run ``dnx ef migrations add MyFirstMigration`` to scaffold a migration to create the initial set of tables for your model.
- Run ``dnx ef database update`` to apply the new migration to the database. Because your database doesn't exist yet, it will be created for you before the migration is applied.

.. tip::
If you make future changes to your model, you can use the ``dnx . ef migration add`` command to scaffold a new migration to apply the corresponding changes to the database. Once you have checked the scaffolded code (and made any required changes), you can use the ``dnx . ef migration apply`` command to apply the changes to the database.
If you make future changes to your model, you can use the ``dnx ef migrations add`` command to scaffold a new migration to apply the corresponding changes to the database. Once you have checked the scaffolded code (and made any required changes), you can use the ``dnx database update`` command to apply the changes to the database.

Create a controller
-------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/aspnet5/sample/global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta6"
"version": "1.0.0-beta7"
}
}

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,51 +1,51 @@
using System;
using System.Collections.Generic;
using Microsoft.Data.Entity.Migrations;
using Microsoft.Data.Entity.Migrations.Builders;
using Microsoft.Data.Entity.Migrations.Operations;
using Microsoft.Data.Entity.SqlServer.Metadata;

namespace EFGetStarted.AspNet5.Migrations
{
public partial class MyFirstMigration : Migration
{
public override void Up(MigrationBuilder migration)
protected override void Up(MigrationBuilder migrationBuilder)
{
migration.CreateTable(
migrationBuilder.CreateTable(
name: "Blog",
columns: table => new
{
BlogId = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", "IdentityColumn"),
Url = table.Column(type: "nvarchar(max)", nullable: false)
BlogId = table.Column<int>(isNullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerIdentityStrategy.IdentityColumn),
Url = table.Column<string>(isNullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Blog", x => x.BlogId);
});
migration.CreateTable(
migrationBuilder.CreateTable(
name: "Post",
columns: table => new
{
PostId = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", "IdentityColumn"),
BlogId = table.Column(type: "int", nullable: false),
Content = table.Column(type: "nvarchar(max)", nullable: true),
Title = table.Column(type: "nvarchar(max)", nullable: true)
PostId = table.Column<int>(isNullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerIdentityStrategy.IdentityColumn),
BlogId = table.Column<int>(isNullable: false),
Content = table.Column<string>(isNullable: true),
Title = table.Column<string>(isNullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Post", x => x.PostId);
table.ForeignKey(
name: "FK_Post_Blog_BlogId",
columns: x => x.BlogId,
referencedTable: "Blog",
referencedColumn: "BlogId");
column: x => x.BlogId,
principalTable: "Blog",
principalColumn: "BlogId");
});
}

public override void Down(MigrationBuilder migration)
protected override void Down(MigrationBuilder migrationBuilder)
{
migration.DropTable("Post");
migration.DropTable("Blog");
migrationBuilder.DropTable("Post");
migrationBuilder.DropTable("Blog");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Infrastructure;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Migrations.Infrastructure;
using Microsoft.Data.Entity.Migrations;
using EFGetStarted.AspNet5.Models;
using Microsoft.Data.Entity.SqlServer.Metadata;

namespace EFGetStarted.AspNet5.Migrations
{
[ContextType(typeof(BloggingContext))]
[DbContext(typeof(BloggingContext))]
partial class BloggingContextModelSnapshot : ModelSnapshot
{
public override void BuildModel(ModelBuilder builder)
protected override void BuildModel(ModelBuilder modelBuilder)
{
builder
.Annotation("ProductVersion", "7.0.0-beta6-13815")
.Annotation("SqlServer:ValueGenerationStrategy", "IdentityColumn");
modelBuilder
.Annotation("ProductVersion", "7.0.0-beta7-15540")
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerIdentityStrategy.IdentityColumn);

builder.Entity("EFGetStarted.AspNet5.Models.Blog", b =>
modelBuilder.Entity("EFGetStarted.AspNet5.Models.Blog", b =>
{
b.Property<int>("BlogId")
.ValueGeneratedOnAdd();
Expand All @@ -26,7 +28,7 @@ public override void BuildModel(ModelBuilder builder)
b.Key("BlogId");
});

builder.Entity("EFGetStarted.AspNet5.Models.Post", b =>
modelBuilder.Entity("EFGetStarted.AspNet5.Models.Post", b =>
{
b.Property<int>("PostId")
.ValueGeneratedOnAdd();
Expand All @@ -40,7 +42,7 @@ public override void BuildModel(ModelBuilder builder)
b.Key("PostId");
});

builder.Entity("EFGetStarted.AspNet5.Models.Post", b =>
modelBuilder.Entity("EFGetStarted.AspNet5.Models.Post", b =>
{
b.Reference("EFGetStarted.AspNet5.Models.Blog")
.InverseCollection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Diagnostics;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Routing;
using Microsoft.Dnx.Runtime;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Logging.Console;
using Microsoft.Framework.Runtime;
using Microsoft.Data.Entity;
using EFGetStarted.AspNet5.Models;

Expand All @@ -28,7 +24,7 @@ public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
Configuration = builder.Build();
}

public IConfiguration Configuration { get; set; }
public IConfigurationRoot Configuration { get; set; }

// This method gets called by the runtime.
public void ConfigureServices(IServiceCollection services)
Expand All @@ -52,6 +48,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole();
loggerFactory.AddDebug();

// Configure the HTTP request pipeline.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="~/images/ASP-NET-Banners-01.png" alt="ASP.NET" class="img-responsive">
<img src="~/images/ASP-NET-Banners-01.png" alt="ASP.NET" class="img-responsive" />
<div class="container">
<div class="carousel-caption">
<p>
Expand All @@ -24,7 +24,7 @@
</div>
</div>
<div class="item">
<img src="~/images/Banner-02-VS.png" alt="Visual Studio" class="img-responsive">
<img src="~/images/Banner-02-VS.png" alt="Visual Studio" class="img-responsive" />
<div class="container">
<div class="carousel-caption">
<p>
Expand All @@ -37,7 +37,7 @@
</div>
</div>
<div class="item">
<img src="~/images/ASP-NET-Banners-02.png" alt="Package Management" class="img-responsive">
<img src="~/images/ASP-NET-Banners-02.png" alt="Package Management" class="img-responsive" />
<div class="container">
<div class="carousel-caption">
<p>
Expand All @@ -50,7 +50,7 @@
</div>
</div>
<div class="item">
<img src="~/images/Banner-01-Azure.png" alt="Microsoft Azure" class="img-responsive">
<img src="~/images/Banner-01-Azure.png" alt="Microsoft Azure" class="img-responsive" />
<div class="container">
<div class="carousel-caption">
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/css/bootstrap.min.css"
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="hidden" asp-fallback-test-property="visibility" asp-fallback-test-value="hidden" />
<link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/css/bootstrap-touch-carousel.css"
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/css/bootstrap-touch-carousel.css"
asp-fallback-href="~/lib/bootstrap-touch-carousel/css/bootstrap-touch-carousel.css"
asp-fallback-test-class="carousel-caption" asp-fallback-test-property="display" asp-fallback-test-value="none" />
<link rel="stylesheet" href="~/css/site.css" asp-file-version="true" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
</environment>
</head>
<body>
Expand Down Expand Up @@ -53,25 +53,26 @@
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/lib/hammer.js/hammer.js"></script>
<script src="~/lib/bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>
<environment names="Staging,Production">
<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
<script src="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
</script>
<script src="//ajax.aspnetcdn.com/ajax/hammer.js/2.0.4/hammer.min.js"
<script src="https://ajax.aspnetcdn.com/ajax/hammer.js/2.0.4/hammer.min.js"
asp-fallback-src="~/lib/hammer.js/hammer.js"
asp-fallback-test="window.Hammer">
</script>
<script src="//ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/js/bootstrap-touch-carousel.js"
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/js/bootstrap-touch-carousel.js"
asp-fallback-src="~/lib/bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel.js"
asp-fallback-test="window.Hammer && window.Hammer.Instance">
</script>
<script src="~/js/site.js" asp-file-version="true"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>

@RenderSection("scripts", required: false)
Expand Down

0 comments on commit e4ec46e

Please sign in to comment.