scafford自动生成Crud存储库asp.net5 [英] scafford auto generate crud repository asp.net5

查看:74
本文介绍了scafford自动生成Crud存储库asp.net5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用Visual Studio 2015,我了解我们可以通过添加新的 scafford 项目来生成Crud View控制器和操作.但是代码生成不是很有用,似乎所有数据层都取决于控制器

Hi I am using visual studio 2015, I understand that we can generate crud view controller and action by adding new scafford item. But the code generation is not very usable seem all the data layer is depend on the controller

所以这是我的问题,是否可以使用scafford生成代码,同时生成存储库模式?还是任何具有相同功能的nuget?

So Here is my question is tat any way to use scafford generate the code which also generate the repository pattern also? Or any nuget which offer the same feature?

对不起.我搜索了几个小时.但是仍然找不到解决方案.:(

Sorry. I had googling few hour . But still cant find the solution. :(

谢谢

推荐答案

我同意,这是MVC Core(MVC6)中的问题.为了能够与Add Scaffold Controller一起使用,必须在 project.json "dependencies" 部分中包含一些附加包.如果您使用RC1,则应包含

I agree, that it's a problem in MVC Core (MVC6). To be able to work with Add Scaffold Controller on have to include some additional packages in "dependencies" part of project.json. If you use RC1 then you should include

"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final"

看到您现在想念的Visual Studio中的向导就足够了.

It should be enough to see the Wizard in Visual Studio, which your miss now.

要能够在命令行界面中使用脚手架(例如, dnx ef dbcontext脚手架... ),您需要添加更多的依赖项

To be able to use in the command line interface for scaffolding (dnx ef dbcontext scaffold ... for example) you need to add more dependencies

"EntityFramework.MicrosoftSqlServer.Design": "7.0.0-rc1-final",
"EntityFramework.Relational.Design": "7.0.0-rc1-final"
"EntityFramework.Commands": "7.0.0-rc1-final"

添加以在 project.json "commands" 部分中添加"ef":"EntityFramework.Commands" .

add to add "ef": "EntityFramework.Commands" in "commands" section of project.json.

另一个问题是,将产品名称从ASP.NET 5更改为ASP.NET Core后,所有包的重命名都将重命名为float.版本"7.0.0-rc1-final"中的程序包"EntityFramework.MicrosoftSqlServer"被重命名为版本"1.0.0-rc2-16811"中的"Microsoft.EntityFrameworkCore.SqlServer",程序包中的"Microsoft.AspNet.Mvc"版本"6.0.0-rc1-final"在版本"1.0.0-rc2-17011"中的"Microsoft.AspNetCore.Mvc"中已重命名,依此类推(我使用了

An additional problem bring renaming float of all packages after changing the product name from ASP.NET 5 to ASP.NET Core. The Package "EntityFramework.MicrosoftSqlServer" in version "7.0.0-rc1-final" is renamed to "Microsoft.EntityFrameworkCore.SqlServer" in version "1.0.0-rc2-16811", the package "Microsoft.AspNet.Mvc" in version "6.0.0-rc1-final" is renamed in "Microsoft.AspNetCore.Mvc" in version "1.0.0-rc2-17011" and so on (I used the today's latest builds from https://www.myget.org/F/aspnetcidev/).

我建议今天停留在RC1上,并等待重命名过程结束.我发布了建议,该建议可以简化现有项目的迁移,但建议并非如此公认.微软已经将RC2和RTM的日期从2月和Q1更改为未知(请参见官方上的TBD路线图).我希望这个问题能在短时间内解决.

I would recommend to stay today on RC1 and to wait for the end of renaming process. I posted the suggestion, which could simplify the migration of existing projects, but the suggestion was not accepted. Microsoft have change the date of RC2 and RTM from February and Q1 to unknown (see TBD on the official roadmap). I hope that the problem will be solved in a short time.

这篇关于scafford自动生成Crud存储库asp.net5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆