efcore
efcore copied to clipboard
Exception on upgrade [Bug]
Exception on: Database.Migrate();
An exception of type 'System.ArgumentException' occurred in EntityFramework.Core.dll but was not handled in user code
Additional information: The properties expression 'u => Convert(Convert(u).Id)' is not valid. The expression should represent a property access: 't => t.MyProperty'. When specifying multiple properties use an anonymous type: 't => new { t.MyProperty1, t.MyProperty2 }'.
I guess the exception occurred because you entered wrong syntax. can you put your code?
Its worked correctly before dnu restore
public class Account : IdentityUser
{
public string Firstname { get; set; }
public string Lastname { get; set; }
public DateTime Birthdate { get; set; }
public bool Gender { get; set; }
```
public string GetGender()
{
return Gender ? "Male" : "Female";
}
}
public class EfContext : IdentityDbContext
{
private static bool _created = false;
public DbSet Accounts { get; set; }
public DbSet Sites { get; set; }
public DbSet Pages { get; set; }
public EfContext()
{
// Create the database and schema if it doesn't exist
// This is a temporary workaround to create database until Entity Framework database migrations
// are supported in ASP.NET 5
if (!_created)
{
Database.Migrate();
// this.Configuration.ProxyCreationEnabled = false;
_created = true;
}
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=***;Database=***; User Id=**; Password=*****; MultipleActiveResultSets=true");
}
}
```
possible dupe of #3267
Fixed now (see #3267)