Code: Select all
public class MyEntity
{
public long Id { get; set; }
public DateTime? DeletedAt { get; set; }
}
Code: Select all
public class MyEntityConfiguration : EntityTypeConfiguration
{
public MyEntityConfiguration()
{
HasKey(m => m.Id);
Property(m => m.Id)
.HasColumnName("Id")
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
Property(m => m.DeletedAt)
.IsOptional();
}
}
Code: Select all
public class MyMigration : DbMigration
{
public override void Up()
{
CreateTable(
"MyEntities",
c => new
{
Id = c.Long(nullable: false, identity: true),
DeletedAt = c.DateTime(),
})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropTable("MyEntities");
}
}
Code: Select all
CREATE TABLE "MyEntities" (
"Id" NUMBER(18) NOT NULL,
"DeletedAt" TIMESTAMP NOT NULL,
PRIMARY KEY ("Id")
)
CREATE SEQUENCE "MyEntities_SEQ"
CREATE OR REPLACE TRIGGER "MyEntities_INS_TRG"
BEFORE INSERT ON "MyEntities"
FOR EACH ROW
BEGIN
SELECT "MyEntities_SEQ".NEXTVAL INTO :NEW."Id" FROM DUAL;
END;
Is this a bug or am I doing something wrong?