You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use ef core, inside y dbcontext class I overrided the onModelCreating method to configure one property in a class to be auto-increment in sql server
My DbContext class:
public class AppDbContext:IdentityDbContext<AppUser>
{
public AppDbContext(DbContextOptions options) : base(options)
{
}
public AppDbContext()
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<Service>().Property(service => service.ID).UseIdentityColumn(1, 1);
}
public virtual DbSet<AppUser> AppUsers { get; set; }
public virtual DbSet<Service> Services { get; set; }
}
If you notice that my DbContext class is inherited from IdentityDbContext because I use Identity.
The problem:
The problem is visual studio show me an error
Error:
Severity Code Description Project File Line Suppression State
Error CS0121 The call is ambiguous between the following methods or properties: 'Microsoft.EntityFrameworkCore.OraclePropertyBuilderExtensions.UseIdentityColumn<TProperty>(Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty>, int, int)' and 'Microsoft.EntityFrameworkCore.SqlServerPropertyBuilderExtensions.UseIdentityColumn<TProperty>(Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<TProperty>, int, int)'
Additional info:
I reference another project in my solution this project will play the repository role, and he prepared to work with SqlServer, Oracle and MySQL.
If you're using multiple providers which have the concept of identity columns, you're going to have to fully-qualify the method call; so instead of calling it like an extension method, call it like a static method:
I use
ef core
, inside ydbcontext
class I overrided theonModelCreating
method to configure one property in a class to be auto-increment insql server
My DbContext class:
If you notice that my DbContext class is inherited from
IdentityDbContext
because I useIdentity
.The problem:
The problem is visual studio show me an error
Error:
Error Screenshot 1
Error Screenshot 2
Additional info:
I reference another project in my solution this project will play the repository role, and he prepared to work with
SqlServer
,Oracle
andMySQL
.The project I depend on is my own project, and it is open source that is the repository link
Please any help to fix this issue ?
The text was updated successfully, but these errors were encountered: