[Varray数据类型未使用Devart oracle dot connect 9与.net核心实体进行映射

问题描述 投票:0回答:1

我正在尝试使用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
    }

我做错什么了吗?如果需要更多详细信息,请发表评论。

asp.net-core entity-framework-core devart varray
1个回答
0
投票

Devart EF Core提供程序支持的Oracle数据类型的列表位于https://www.devart.com/dotconnect/oracle/docs/?DataTypeMapping.html

当前尚未通过EF Core支持OracleType,但是您可以通过普通的ADO.NET使用它:https://www.devart.com/dotconnect/oracle/docs/?Varray.html

© www.soinside.com 2019 - 2024. All rights reserved.