Hi,
I have added a column 'IsDeleted' to every entity in my Entity Framework 4.0 model and implemented an Interface for it. How can i accomplish that the entities with 'IsDeleted' set to 'true' are ignored by all Objectsets and Navigationproperties in my model? Filtering the result using LinQ does not work i think, because the result can not be transformed back into an ObjectSet.
Can anybody help me please?
BTW: My template generates ObjectSets in the context-class like this:
Private _Persons As ObjectSet(Of Person)
Public ReadOnly Property Persons() As ObjectSet(Of Person)
Get
If (_Persons Is Nothing) Then
_Persons = MyBase.CreateObjectSet(Of Person)("Persons")
End If
Return _Persons
End Get
End Property
and navigation properties for the entities like this one:
<XmlIgnoreAttribute()>
<SoapIgnoreAttribute()>
<DataMemberAttribute()>
<EdmRelationshipNavigationPropertyAttribute("Model", "Map_Persons_Organisations", "Persons")>
Public Property Persons() As EntityCollection(Of Person)
Get
Return CType(Me,IEntityWithRelationships).RelationshipManager.GetRelatedCollection(Of Person)("Model.Map_Persons_Organisations", "Persons")
End Get
Set
If (Not value Is Nothing)
CType(Me, IEntityWithRelationships).RelationshipManager.InitializeRelatedCollection(Of Person)("Model.Map_Persons_Organisations", "Persons", value)
End If
End Set
End Property