Levis
Levis
CC#
Created by Levis on 11/27/2023 in #help
ASP.NET Core 8 Web API, can't use additional fields with Identity registration
Thanks, that's exactly what I was looking for
9 replies
CC#
Created by Levis on 11/27/2023 in #help
ASP.NET Core 8 Web API, can't use additional fields with Identity registration
9 replies
CC#
Created by Levis on 11/27/2023 in #help
ASP.NET Core 8 Web API, can't use additional fields with Identity registration
No description
9 replies
CC#
Created by Levis on 11/27/2023 in #help
ASP.NET Core 8 Web API, can't use additional fields with Identity registration
DbContext:
public class DataContext : IdentityDbContext<User>
{
public DataContext(DbContextOptions<DataContext> options) : base(options)
{

}

public DbSet<Product> Products { get; set; }
public DbSet<Category> Categories { get; set; }
public DbSet<Models.Type> Types { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);

modelBuilder.Entity<Product>()
.HasOne(p => p.Seller)
.WithMany(u => u.Products)
.HasForeignKey(p => p.SellerId);
}
}
public class DataContext : IdentityDbContext<User>
{
public DataContext(DbContextOptions<DataContext> options) : base(options)
{

}

public DbSet<Product> Products { get; set; }
public DbSet<Category> Categories { get; set; }
public DbSet<Models.Type> Types { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);

modelBuilder.Entity<Product>()
.HasOne(p => p.Seller)
.WithMany(u => u.Products)
.HasForeignKey(p => p.SellerId);
}
}
9 replies
CC#
Created by Levis on 11/27/2023 in #help
ASP.NET Core 8 Web API, can't use additional fields with Identity registration
This is my model:
public class User : IdentityUser
{
public int Id { get; set; }
public string Name { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string? Facebook { get; set; }
public string? Instagram { get; set; }
public string? WhatsApp { get; set; }
public string Location { get; set; }
public ICollection<Product> Products { get; set; }
}
public class User : IdentityUser
{
public int Id { get; set; }
public string Name { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string? Facebook { get; set; }
public string? Instagram { get; set; }
public string? WhatsApp { get; set; }
public string Location { get; set; }
public ICollection<Product> Products { get; set; }
}
9 replies