Я использую этот код VB для сериализации моей модели EF в Xml:
Try
Dim serializer = New XmlSerializer(GetType(GestionEDLService.Biens))
Dim localFolder As StorageFolder = ApplicationData.Current.LocalFolder
Dim sampleFile As StorageFile = Await localFolder.CreateFileAsync("dataFile.xml", CreationCollisionOption.OpenIfExists)
Dim stream As Stream = Await sampleFile.OpenStreamForWriteAsync()
serializer.Serialize(stream, MyEFModel.MyEntity)
Catch ex As Exception
Debug.WriteLine(ex.ToString)
End Try
РЕДАКТИРОВАТЬ: Вы также можете использовать DataContractSerializer как этот
Imports System.Runtime.Serialization
Public Sub WriteToStream(sw As System.IO.Stream)
Dim dataContractSerializer As New DataContractSerializer(GetType(MyDataSource))
dataContractSerializer.WriteObject(sw, _MyDataSource)
End Sub
Public Sub ReadFromStream(sr As System.IO.Stream)
Dim dataContractSerializer As New DataContractSerializer(GetType(MyDataSource))
_MyDataSource = dataContractSerializer.ReadObject(sr)
End Sub
HTH