Entity Framework and Soft Remote Entries

I am developing a WCF service that uses a data structure as a data source. Almost everything is fine, except for the problem with deleted records. In our database we use soft delete (record label attribute IsDeleted = true). My question is how to exclude soft deleted records from a set of objects?

For example, object "A" has an object that sets "Bs" (FK to table "B"). How to make the "Bs" object set only contains entries that are not deleted?

thanks

+6
entity-framework
source share
3 answers

I wrote a post about this topic, hope this helps.

http://blog.jorgef.net/2010/12/ef-soft-delete.html

+6
source share

One way is to use a defining query. But we usually handle this in the repository, since we really want to materialize soft remote objects in rare cases.

0
source share

You can map EF objects to views instead of tables

CREATE VIEW vw_Currency AS SELECT * FROM Currency c WHERE c.IsAKDeleted=0 

I worked on a system that used this approach, but was not based on EF. I have not tried this with EF

0
source share

All Articles