Skip to content

Entity created by table splitting is not executed when inserting data #25132

Closed

Description

File a bug

Remember:

I follow the official document to configure the table splitting, the query can work normally, but the writing does not work normally, and no error is reported.And no SQL output is observed in the log [Who is out of the queried SQL].

doc: https://docs.microsoft.com/en-us/ef/core/modeling/table-splitting

Where should I start the investigation or is this a bug?

Include your code

The table does not have any foreign keys, and there are no additional attributes in the entity configuration. I am a single table.

I omitted other fields here

   // first
    [Table("eform_vms_projectaction")]
    public partial class ProjectAction
 {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Column(IVMSDbAuditEntity.CLOLUMN_NAME_ID)]
        public string Id { get; set; }

        public EvaluationAction EvaluationAction { get; set; }
         //...
}
   // two
    [Table("eform_vms_projectaction")]
    public partial class EvaluationAction 
 {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Column(IVMSDbAuditEntity.CLOLUMN_NAME_ID)]
        public string Id { get; set; }

         //...
}

for DbContextConfig:

            EntityTypeBuilder<ProjectAction> tempBuilder = modelBuilder.Entity<ProjectAction>();
            tempBuilder
                .HasOne(o => o.EvaluationAction).WithOne()
                .HasForeignKey<EvaluationAction>(o => o.Id);

for logic code:

                EvaluationAction evaluationAction = new EvaluationAction()
                {
                    Id = Guid.NewGuid().ToString(),
                   //..
                };
                db.EvaluationActions.Add(evaluationAction);
                db.SaveChanges();

Include stack traces

no error! No Insert SQL Show!;

Include verbose output

none

Include provider and version information

EF Core version:3.1.14
Database provider: Pomelo.EntityFrameworkCore.MySql
Target framework: .net core 3.1
Operating system:
IDE: e.g. Visual Studio 2019 16.9.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions