无法检索元数据..... [英] Unable to retrive Metadata for.....
问题描述
我有一个数据库。
我使用指向已建数据库的连接字符串添加了一个edmx文件。
我使用脚手架创建了控制器和视图。
我想修改创建控制器。
为此,我添加了一个UserRegisterViewModel。
我试图通过右键单击操作并选择abcviewmodel创建一个视图createview对话框中的必要值。
但是我收到了一个错误。 无法回复元数据...
这是我的视图模型
public class UserRegisterViewModel
{
public int UserId { get ; set ; }
[必需]
[显示(名称= 用户名)]
public string 用户名{获得跨度>; set ; }
[必需]
[StringLength( 100 ,ErrorMessage = {0}长度必须至少为{2}个字符。,MinimumLength = 6 ) ]
[DataType(DataType.Password)]
[显示(名称= 密码)]
public string 密码{获得跨度>; set ; }
[DataType(DataType.Password)]
[显示(名称= 确认密码)]
[比较( 密码,ErrorMessage = 密码和确认密码不匹配。)]
public string ConfirmPassword { get ; set ; }
[必填]
public string 电子邮件{获得跨度>; set ; }
[必需]
public string TeamName {获得跨度>; set ; }
}
这是我在控制器中的动作方法
public ActionResult Register()
{
return 视图跨度>();
}
我多次构建我的项目但未能创建视图。
I have a database.
I added an edmx file using the connection string pointing to the already built database.
I created controller and view using scaffolding.
I want to modify the "Create" controller.
For that i added an "UserRegisterViewModel".
I tried to create a view out of "abcviewmodel" by right clicking on the action and selecting neccessary values in the "createview" dialog box.
But i got an error. "Unable to retrive metadata for... "
Here is my viewmodel
public class UserRegisterViewModel
{
public int UserId { get; set; }
[Required]
[Display(Name = "User name")]
public string Username { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
[Required]
public string Email { get; set; }
[Required]
public string TeamName { get; set; }
}
here is my action method in controller
public ActionResult Register()
{
return View();
}
I built my project many times but failed to create view.
这篇关于无法检索元数据.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!