我正在尝试使用 Devart EFCore 9.8 和 MSEFCore 2.2.4 中的 Oracle 点连接试用许可证从表(oracle db 12c)中获取数据。但是 VARRAY 列没有被映射。它抛出异常 -
System.InvalidOperationException: The property 'TierInfoTemp.num_arr'
is of type 'OracleType' which is not supported by current database
provider. Either change the property CLR type or ignore the property
using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.
Ignore' in 'OnModelCreating'.
我的 DBContext.cs:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TierInfoTemp>(entity =>
{
OracleConnectionStringBuilder oraCSB = new OracleConnectionStringBuilder();
oraCSB.Direct = true;
oraCSB.Server = "xxx";
oraCSB.Port = xxxx;
oraCSB.Sid = "xxxx";
oraCSB.UserId = "xxxx";
oraCSB.Password = "xxx";
entity.Property(e => e.num_arr).HasColumnType("VARRAY")
.HasConversion<OracleType>();
});
}
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options)
{
}
public virtual DbSet<TierInfoTemp> tier_info_temp { get; set; }
实体:
public class TierInfoTemp
{
[Column("TIER_ID")]
[Key]
public int tier_id { get; set; }
[Column("TIER_NAME")]
public string tier_name { get; set; }
[Column("IS_ACTIVE")]
public int is_active { get; set; }
[Column("REGION_ID")]
public int region_id { get; set; }
[Column("NUM_ARR")]
public OracleType num_arr { get; set; } ///VARARY Field
}
我做错什么了吗?如果需要更多详细信息,请发表评论。