asp.net-mvc-scaffolding

Entity Framework 4.1 Database First does not add a primary key to the DbContext T4 generated class

强颜欢笑 提交于 2019-12-01 04:12:36
I am just getting started with Entity Framework 4.1, trying out the "database first" mode. When EF generates a Model class with the "ADO.Net DbContext Generator," shouldn't it identify the primary key for the class with a [Key] attribute? Without this, it appears incompatible with the T4 MVCScaffolding. Here are the details: Using the Entity Data Model Designer GUI, I have added a simple "country" table to the model from my existing database. The GUI correctly identifies a single integer identity key field named "PK" as my primary key. (Alas! I'm a new user so I can't add a screenshot. I've

Entity Framework 4.1 Database First does not add a primary key to the DbContext T4 generated class

倾然丶 夕夏残阳落幕 提交于 2019-12-01 01:25:56
问题 I am just getting started with Entity Framework 4.1, trying out the "database first" mode. When EF generates a Model class with the "ADO.Net DbContext Generator," shouldn't it identify the primary key for the class with a [Key] attribute? Without this, it appears incompatible with the T4 MVCScaffolding. Here are the details: Using the Entity Data Model Designer GUI, I have added a simple "country" table to the model from my existing database. The GUI correctly identifies a single integer

Scaffolding controllers with repositories in Mvc5, EF6, VisualStudio 2013

二次信任 提交于 2019-11-30 17:41:15
In vs2012 I used to use Steve Sanderson's mvcScaffolding Package with this package I could scaffold Action Methods with unit tests and controllers with repositories and dependency injection. My question is simple. Is there a way to do so in vs2013? When I install the package in vs2013 I get the following errors: Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE At C:\dev\WebApplication2\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:50 char:9 + Set-DefaultScaffolder -Name CustomTemplate -Scaffolder T4Scaffolding.Cus ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Update Visual Studio 2017 MVC View Scaffolding to Bootstrap 4

邮差的信 提交于 2019-11-30 02:40:15
问题 I've just updated my Visual Studio 2017 ASP.NET MVC 5 application from Bootstrap v3 to v4. I'm finding when I add a new edit partial view using scaffolding, it is still using the Bootstrap v3 CSS class names for the form. Is there a way to update the scaffolding to use BS v4? Edit There seems to be some confusion about what I'm talking about. In Visual Studio 2017, in an MVC project, in Solution Explorer, right click the Views folder > Add > View... > MVC 5 View > Click Add . This brings up

Scaffolding controllers with repositories in Mvc5, EF6, VisualStudio 2013

对着背影说爱祢 提交于 2019-11-30 01:10:54
问题 In vs2012 I used to use Steve Sanderson's mvcScaffolding Package with this package I could scaffold Action Methods with unit tests and controllers with repositories and dependency injection. My question is simple. Is there a way to do so in vs2013? When I install the package in vs2013 I get the following errors: Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE At C:\dev\WebApplication2\packages\T4Scaffolding.Core.1.0.0\tools\init.ps1:50 char:9 + Set-DefaultScaffolder -Name

Custom scaffold templates in ASP.NET Core

烈酒焚心 提交于 2019-11-27 18:12:11
Now that I figured out how to enable scaffolding in ASP.NET Core MVC (see View scaffold templates in ASP.NET Core ), I'd like to create custom template files for Views. I found one place that said the template files are located here: C:\Users\{user name}\.dnx\packages\Microsoft.Extensions.CodeGenerators.Mvc\1.0.0-rc1-final\Templates\ViewGenerator But I copied an existing file there and that copied file does not appear in the Template dropdown on the Add View dialog. Are they located elsewhere, or do I have to do something to get files added in that folder to appear? Restarting Visual Studio

Is MvcScaffolding compatible with VS 2013 RC by command line?

一笑奈何 提交于 2019-11-27 14:03:44
At NuGet when I try to install MvcScaffolding, by typing: Install-Package MvcScaffolding I am getting this error Set-DefaultScaffolder : Cannot get an instance of EnvDTE.DTE Is it happening because of this new scaffolding engine in Visual Studio 2013 ? antinescience I emailed Scott Hanselman about this a few weeks back. Here's his response: We've found out what's up and we are going to release a fixed version, although we're taking Scaffolding in a new direction with VS2013 we still want this to work. Thanks for finding this bug. So I'd keep eyes peeled for a new release of MvcScaffold that

How to create custom scaffold templates in ASP.NET MVC5?

断了今生、忘了曾经 提交于 2019-11-27 13:45:00
I'm using ASP.NET MVC5 and VS2013 I've tried to copy CodeTemplates folder from C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\VWDExpress\ItemTemplates\CSharp\Web\MVC 4\CodeTemplates with subfolders "AddController", "AddView" and T4 templates inside them, then I modified some templates, but nothing happened when I tried to add View nor Controller.. Lin First, it looks like you have Visual Studio 2013 and 2012 both installed on your computer. I tried looking up the path you provided, I couldn't find it. On your path it looks like you're trying to use MVC4 templates. Here is my

Application can't scaffold items

百般思念 提交于 2019-11-27 00:53:47
I created an MVC 5 application in VS 2013 Professional and then used EF 6.1 code first with an existing DB on SQL Server Express. When I try to create the views I’m using the “New scaffolded item…” then selecting the “MVC 5 controller with views, using Entity Framework.” I select the model and context classes and click OK. Then the following error message appears and no code is created. I’ve uninstalled EF Power Tools with the same error. Error There was an error running the selected code generator: ‘Exception has been thrown by the target of an invocation.’ I've also tried uninstalling

Scaffolding controller doesn't work with visual studio 2013 update 2

一曲冷凌霜 提交于 2019-11-26 18:40:14
PROBLEM: I have updated to Visual Studio 2013 update 2 and now I cannot scaffold controllers. The problem is not project specific: when I try to scaffold a controller, I get the following error in ALL and ANY project: There was an error running the selected code generator: 'Exception has been thrown by the target of an invocation.' It was working before updating to Visual Studio 2013 update 2. Have googled the issue to death, but none of the various suggestions work Eg: Commenting out OnModelCreating in my context; Removing packages such as MvcScaffolding, etc (I have none installed and it