Base solution for your next web application
Open Closed

delete error #1329


User avatar
0
iamnish created

public class Accountmain : FullAuditedEntity, IMustHaveTenant {

    [Required]
    public virtual int TenantId { get; set; }

    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public virtual int Amslno { get; set; }


    [Required]
    [StringLength(50)]
    public virtual string Accmain { get; set; }

    [Required]
    [StringLength(2)]
    public virtual string Posting { get; set; }  

    [Required]
    [StringLength(2)]
    public virtual string Side { get; set; }  


}

above is my entity .when i am adding new record id is always zero in database .while deleting if I provide only Amslno its not working but if all the elements are provided then delete is working perfectly .


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Your entity is deriving from FullAuditedEntity which includes Id field as primary key.

    If you want to use AmslNo instead of this Id field as primary key, please check this issue <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/586">https://github.com/aspnetboilerplate/as ... issues/586</a>.