Possible Duplicate:
Delete an object and all of its related entities in Entity Framework
I have looked for a while on how to do this, but found none of the posts addressing this issue. These are the classes for setting up the db:
public class Claim
{
[Key,DatabaseGenerated(System.ComponentModel.DataAnnotations.DatabaseGeneratedOption.Identity)]
public int DraftID { get; set; }
public int ClaimID { get; set; }
public string SupplierCode { get; set; }
public ClaimStatus Status { get; set; }
public Policy Policy { get; set; }
}
my context:
public class FnxDbContext:DbContext {
public FnxDbContext() : base() { this.Configuration.ProxyCreationEnabled = false; } public DbSet<Claim> Claim { get; set; }
Now let's say I want to remove the Claim
-entity with the DraftID that is "1"
(there is such a record in the DB with FK to other tables as needed)
How do I do this? I tried many ideas I found on the net. Most of them talk about a single entity.
Can anyone help me with this issue?