我正在尝试将测试项目添加到我的解决方案中。我创建了一个测试项目并引用了原始项目。 在我的测试中,我只是想找到一个AppUser(身份用户)。
这是我的AppUser定义:
public class AppUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<AppUser> manager, string authenticationType)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, authenticationType);
// Add custom user claims here
return userIdentity;
}
public virtual List<ShoppingList> ShoppingLists { get; set; }
public virtual List<Notification> Notifications { get; set; }
public string ImageUrl { get; set; }
}
我原来的项目运作正常! 在我的app.config中,我将连接字符串设置为原始项目.mdf文件。 但是,每当我运行测试时,我都会遇到以下异常:
System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Invalid column name 'Discriminator'.
Invalid column name 'Discriminator'.
Invalid column name 'ImageUrl'.
Invalid column name 'Discriminator'.
Invalid column name 'Discriminator'.
Invalid column name 'Discriminator'.
Invalid column name 'ImageUrl'.
Invalid column name 'Discriminator'.
Invalid column name 'Discriminator'.
Invalid column name 'Discriminator'.
Invalid column name 'ImageUrl'.
Invalid column name 'Discriminator'..