views:

22

answers:

2

I am developing a .NET framework application that allows users to maintain and save "projects". A project can consist of components whose types are defined in the assemblies of the framework itself and/or in third-party assemblies that will be made available to the framework via a yet-to-be-built plug-in architecture. When a project is saved, it is simply binary-serialised to file.

Projects are portable, so multiple users can load the same project into their own instances of the framework (just as different users may open the same MSWord document in their own local copies of MSWord). What's more, the plug-ins available to one user's framework might not be available to that of another.

I need some way of ensuring that when a user attempts to open (i.e. deserialise) a project that includes a type whose defining assembly cannot be found (either because of a framework version incompatibility or the absence of a plug-in), the project still opens but the offending type is somehow substituted or omitted. Trouble is, the research I've done to date does not even hint at a suitable approach. Any ideas would be much appreciated, thanks.

A: 

You will need to make your own serializer using reflection.

SLaks
Yeah, I wondered about this but didn't really want to go there. That said, I also need to reduce the serialised footprint of a project - another reason for a bespoke serializer. Thanks for the response.
Chris
A: 

This issue is deeply dependent on your architecture. Interfaces and Dependency Injection are used to achieve the "pluggable" architecture you describe, but only you can determine how to "recover" from unavailable type definitions. Your design will need to account for the fact that any component of a project might not load.

Dave Swersky