Serialization customizations

Oct 16, 2013 at 8:49 PM
Edited Oct 17, 2013 at 7:33 PM
Hello, i have a Service, which contain Project : ModelBase.
And this Project contains Dictionary<string /PAth/, IFile /Reference to some file model base/>.
I wan't to save all this Models (Project and IFiles) to separate locations.
I've created some custom ISavableModel which allows Save(as) and Load(From) and store last location so on Save it saving to last location, if last location is null it's pop-out Dialog where to save it or cancel Saving.
But to save all child Models i have to iterate over this dictionary. I want to use SerializerModifierBase for that.
Also i'm saving Workspace (view positions, etc.) to file and i want to use that data after it have been loaded from file. I've created
    public class NotifyingXmlSerializer : XmlSerializer
        public NotifyingXmlSerializer(ISerializationManager serializationManager,
            IDataContractSerializerFactory dataContractSerializerFactory)
            : base(serializationManager, dataContractSerializerFactory)

        protected override void BeforeSerialization([NotNull] ISerializationContext<XElement> context)
            if (context.Model is ISerializationNotifyible)
                (context.Model as ISerializationNotifyible).BeforeSerialization();
Is it OK?

The third problem is how to warry user what he is Saving before Save. Like when you are closing project in MSVC. My models not always have ViewModels so i can't use IViewModelManager to do it, is there any analog for Models?

Thank you.
Oct 17, 2013 at 9:26 PM
Why would you let the objects know about the serialization on forehand? You can convert the Dictionary to a list of models which are then automatically serialized correctly.

We don't provide a "Model Manager" out of the box because in 99,9 % of the cases the end-developer wants to create his / her own store and model handling.