Question: I use Entity Framework 6.0.2 as ORM, I create new type

```
public class DataSourceImportReport
{
    public int Id { get; set; }
    public int ImportedCount { get; set; }
    public DateTime ImportDate { get; set; }
    public DataSource DataSource { get; set; }
}

```

and I added mapping to `OnModelCreating` method

```
ModelBuilder
    .Entity<DataSourceImportReport>()
    .Map(m => m.ToTable("DataSourceImportReports", dataSourceSchemaName));

```

I want to get the SQL statements generated by EF to add proper table in database.

How can I do this?

Answer: 
I managed to resolve this issue by reinstalling(updating) references to EntityFramework and Microsoft.AspNet.Identity.

This will, however, create an incompatibility with existing CodeFirst migrations and database. 

Since my service is not yet live, it was not a problem for me to just delete the database and recreate the migrations, however it might be a deal breaker for a service already running.

What I also did, was changed a line in IdentityModels.cs in function onModelCreating from:

```
modelBuilder.Entity<IdentityUserLogin>().HasKey<string>(l => l.UserId);

```

to:

```
modelBuilder.Entity<IdentityUserLogin>().HasKey(l => new { l.UserId, l.LoginProvider, l.ProviderKey });

```
You should first save the user as an ApplicationUser:

```
var user = new ApplicationUser() { Id = User.Identity.GetUserId(), UserName = "user", Email = "user@domain.com" };
IdentityResult result = await UserManager.CreateAsync(user);

```

Then you can create a login record:

```
result = await UserManager.AddLoginAsync(user.Id, new UserLoginInfo("loginProvider", "providerKey"));

```