问题标签 [asp.net-mvc-scaffolding]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
279 浏览

asp.net-mvc-3 - 在 Ajax 网格脚手架中搜索

我正在使用 Ajax Grid Scaffolder 在 asp.net mvc3 中对网格进行内联编辑。它默认不提供搜索选项。是否有任何其他包与 Ajax Grid Scaffolder 具有相同的帮助方式,但具有搜索选项,或者唯一的方法是手动执行?

0 投票
1 回答
6330 浏览

asp.net-mvc - ASP.NET MVC:在一个视图中显示多个模型(一对多关系)

我正在尝试使用 MVCScaffolding 和 ASP.NET 组合(我认为是)一个简单的 ASP.NET Web 应用程序。SQL 中有一个基本的数据表层次结构:dbo.Albums、dbo.Tracks。

模型很简单。对于专辑:

基本的 CRUD 视图已构建并且工作正常。但是,我正在尝试构建一个视图,该视图显示Album模型数据,后跟一个表,其中一行用于给定 AlbumId 的每个跟踪记录。本质上,这是MVCScaffolding 模板中的Details视图后跟的视图,但它使用两个模型并有一个参数(来自表)。IndexIDAlbums

我试图将模型添加在一起以从那里访问数据,但我不知道如何迭代列表(索引视图使用@model IEnumerable<Music.Models.Tracks>)。这是组合模型:

我正在尝试在 AlbumsExt.cshtml 中使用@model Music.Models.AlbumsExtended. 控制器如下所示:

但显然这是不正确的。

0 投票
1 回答
324 浏览

asp.net-mvc - MVCScaffoliding 包抛出 MethodInvocationException

我最近使用 NuGet 2.0 升级了我的 VisualStudio 2010 安装,这似乎破坏了 Hanselman 和 Kirkland 的 MvcScaffolding 包。每当我尝试构建一个新的控制器和带有存储库的视图时,我都会在脚手架期间得到一个 MethodInvocationError。具体来说,System.Management.Automation.MethodInvocationException 用“5”个参数调用“Execute”。你调用的对象是空的。根据堆栈跟踪,这发生在 NuGet.PackageExtensions.GetFiles() 方法中。当然,堆栈转储中的最后一条语句是“您可能需要升级到较新版本的 MvcScaffolding”,但我确定这是附加到所有错误的末尾。我目前正在使用最新的 MvcScaffolding 包的 v1.0.7。任何人都对为什么会发生这种情况有任何想法,更好的是,如何解决它?谢谢。

0 投票
2 回答
6928 浏览

asp.net - NuGet execution policy errors when installing MvcScaffolding package

I'm using Visual Web Developer Express 2010, Windows XP, and using ASP.NET MVC4 RC in a project. I have NuGet v2.0.30619.9119 installed.

I'm now trying to install the MvcScaffolding package via NuGet Package Manager Console. I get the following errors:

Because the init scripts aren't being executed after the install, the MvcScaffolding package is not installed correctly and the scaffold command is not recognised.

I don't know what to do about these code signing issues. Here are the current security settings:

Can I change the Process scope to be Unrestricted? If so, how? Running Set-ExecutionPolicy in the NuGet console does not work:

I've also tried doing all of this as an Administrator and that didn't help either.

Any advice or ideas would be much appreciated.

UPDATE

I can set the process execution policy in NuGet like this:

But when I restart Visual Web Developer, the setting is forgotten and I still get an error as it keeps trying to execute the init.psl files

How can I change the execution policy permanently?

0 投票
0 回答
1065 浏览

asp.net-mvc-3 - Scaffolding Get-ProjectType not recognized as the name of a cmdlet

just tried to get the basic basics up and running and getting some fancy error conditions - most probably some basic steps are screwed up but I don't see the point - so some hints are highly appreciated.

So whats the setup?

What happens?

Try (after installing MvcScaffolding through NuGet Console) to call:

And get the following error:

Fancy thing: of course Get-ProjectType itself seems to work (see below), so I'm kind of stuck right now - as this looks like a powershell issue somehow but the cmdlet itself works at least if called directly but not when inside the script? Any hints would be greatly appreciated!

Thanks a lot.

With Kind Regards, Ives

0 投票
1 回答
631 浏览

visual-studio-2012 - 如何解决 Visual Studio 2012 RC 中 Coded UI Test 和 MVC Scaffolding 之间的冲突

我正在运行 Visual Studio 2012 RC(截至 2012 年 7 月 11 日,所有最新更新都已安装。我有一个 asp.net mvc 4 解决方案

  1. 一个网络项目
  2. 一个单元测试项目
  3. 一个编码的 UI 测试项目
  4. 一个 Web 性能和负载测试项目

当我第一次创建解决方案时,我可以毫无问题地添加编码 UI 测试。但是,今天我尝试创建 Coded UI Test 并收到以下错误

未能加载以下包:C:\Users[文件路径位于此处]\Microsoft.VisualStudio.TestTools.UITesting.dll。编码的 UI 测试现在处于不一致的状态。删除此包并重新启动 Visual Studio 以使用编码的 UI 测试。

之前在使用 Visual Studio 2010 时遇到过类似的问题。我仍然有这个问题。

但是,如果我卸载(通过 NuGet)MVC Scaffolding 和 T4Scaffolding 并重新启动 Visual Studio,我可以再次创建 Coded UI 测试,但如果我重新添加脚手架包并重新启动 Visual Studio,我会再次收到错误并且无法创建 Coded UI 测试.

看起来

  1. Visual Studio 中的脚手架包和编码的 UI 测试之间存在冲突
  2. 原始错误 Visual Studio 2010 错误尚未在 Visual Studio 2012 中修复 - Microsoft 已承认这是一个错误

任何人都可以帮助这个脚手架和编码 UI 测试的粉丝吗?在没有变通方法的情况下使用这两种技术会很棒。

0 投票
1 回答
165 浏览

jpa - 使用 Spring Roo 和 Spring MVC 配置从实体到实体的超链接导航

我使用 Spring Roo + Jpa + Spring MVC。我的域中有几个 @ManyToOne 和 @OneToMany 关系。此外,我为我的实体生成了 Web 脚手架。

所以说我有一个

客户---订单

关系(一个客户有多个订单)。到目前为止,我生成的脚手架允许我查看给定订单的客户是什么。

但是,客户端显示为纯文本。我需要的是从给定订单导航到客户端的链接

对于所有 @ManyToOne 关系,是否可以使用 Spring Roo shell 来实现,还是我必须手动编辑 JSP?

0 投票
2 回答
287 浏览

c# - MVCscaffolding 从数据库生成模型模板

是否可以在使用 MVCscaffolding 和 t4 模板自动生成包含数据库中所有表数据的模型

例如,我的数据库中有一个名为 Customers 的表,它有 3 个字段:

身份证号码

所以我可以制作一个 t4 模板,它会生成这样的东西:(它可以与所有具有其他名称的表 + 字段一起使用)?????

好?任何人?这可能吗?

0 投票
1 回答
1008 浏览

asp.net-mvc-3 - MVCScaffolding 和 Database Sync 用于不断变化的模型

我使用了 Nuget 包管理器中的 MVCScaffolding,并遵循了有关其工作原理的简短教程。它看起来很简单,当我运行 Scaffold Controller Team –Repository -Force它时,它将创建围绕“团队”的所有存储库模式的东西。

然而,为了尝试(并成功)打破这一点,我决定在“团队”类(myRandomField)中添加一个额外的字段。正如我所料,当我编译时,在 MVC 视图中出现错误:

自创建数据库以来,支持“MvcApplication1Context”上下文的模型已更改。手动删除/更新数据库,或使用 IDatabaseInitializer 实例调用 Database.SetInitializer。例如,DropCreateDatabaseIfModelChanges 策略将自动删除并重新创建数据库,并可选择使用新数据为其播种。

显然这个错误是因为我已经更新了模型(代码优先??)并且数据库现在与我的模型“不同步”。

解决此问题的最佳方法是什么?是否有一种简单的方法可以与模型进行数据库同步 - 我计划对我的模型进行大量编辑,因为我开始的项目将逐渐推出(因此每次都进行完整的数据库重建是不可能的)在这种情况下,代码优先对我来说是正确的方法吗?我真的很喜欢这个插件/工具,如果不使用它会很可惜。

0 投票
1 回答
787 浏览

asp.net-mvc-3 - 无法从实体框架脚手架中找到 sql 表

我刚刚创建了一个 asp.net mvc 3 应用程序并添加了这些类,然后添加了控制器以提供 CRUD 页面。访问这些页面时,我可以做所有预期的事情,但由于某种原因,我找不到数据的存储位置。

我检查了 App_Data(启用了显示所有文件)但那里没有 db 我搜索了我的 db 'DbTest1' 但我找不到任何具有创建代理名称的表。

有什么想法吗?

型号类:

数据库上下文:

连接字符串: