If I detach the context I loose all of the relationships and if I don't I can't save later because the entity's context is disposed...
This is an example of my code
Public Sub Save()
Using ctx As HMIEntities = New HMIEntities
ctx.AttachUpdated(Me) //I use this extension method that works fine if I detach in the get method and the entity has no properties as entities
ctx.SaveChanges()
End Using
End Sub
Public Shared Function GetByID(ByVal ID As Integer) As Page
Dim retval As Page
Using ctx As HMIEntities = New HMIEntities
retval = ctx.PageSet.Include("PageContent").FirstOrDefault(Function(p) p.Slug = ID)
End Using
Return retval
End Function
Is this just going to be impossible??