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 think you forget to assign the UserId property to user.Id in user.Logins

```
        user.Logins.Add(new IdentityUserLogin
        {
            LoginProvider = externalLogin.LoginProvider,
            ProviderKey = externalLogin.ProviderKey,
            UserId=user.Id
        });

```
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"));

```