Search Results

Search found 1 results on 1 pages for 'user3474542'.

Page 1/1 | 1 

  • delete data using entity framework

    - by user3474542
    The objective of the method below is to delete the data from the database using entity framework. I am populating the subscriptions entity by passing two parameters and then calling the atttach and remove method of the context class. Bureau entities is the context class. using (BUREAUEntities bureauEntities = new BUREAUEntities()) { var subscription = new SubcriptionRepository().GetSusbcriptionBySubscriptionTypeId(subscriptionTypeId, companyId); bureauEntities.Subscriptions.Attach((DataAccessLayer.DatabaseModel.Subscription)subscription); bureauEntities.Subscriptions.Remove(subscription); bureauEntities.SaveChanges(); } I am getting the following error message at An entity object cannot be referenced by multiple instances of IEntityChangeTracker at line bureauEntities.Subscriptions.Attach((DataAccessLayer.DatabaseModel.Subscription)subscription); Could somebody tell me where am I going wrong ?

    Read the article

1