Q:

Spring.net and protobuf: object instantiation

We currently use protobuf-net in our application and I would like to inject properties after deserialization.
for example, if the serialize object has a property called DataFactory
namespace Project
{
    [ProtoContract]
    public class Model
    {
        [ProtoMember]
        public String Name { get; set; }

        [ProtoIgnore]
        public IDataFactory DataFactory { get; set; }
    }
}

in the Spring.config file, you have the definition of your interface:
<object id="IDataFactory" type="Project.Impl.DataFactory, Project" />

How could I say (or associate) that the deserialization set the property IDataFactory.
It is on open question, so please feel free to contribute with ideas or suggestions. 
I think it would be great to hook the object instantiator of protobuf-net library so that it uses Spring.NET to create object and then set properties. How do you think I could do this ?
Thanks !
Ideal scenario
I would like to have the DataFactory directly set by Spring.net after a protobuf deserialization.
Model model = Serializer.Deserialize<Model>(stream);
Assert.IsNotNull(model.DataFactory);
Assert.IsTrue(model.DataFactory is DataFactory);

A:

A simpler approach than trying to insert Spring.NET into the instantiation of the object by ProtoBuf is to ask Spring.NET to configure the dependencies of your object after its been constructed.  The IObjectFactory interface provides a method, IObjectFactory.ConfigureObject(object target, string name), that is intended to do just that.
For more info, see http://springframework.net/doc-latest/reference/html/objects.html#objects-factory-extension

A:

This is basically a code example for sbohlen's answer from earlier.
Say you have the following Spring.Net xml config file objects.xml:
<?xml version="1.0" encoding="utf-8"?>
<objects xmlns="http://www.springframework.net">

  <object id="IDataFactory" type="Project.Impl.DataFactory, Project" />

  <object id="MyModel" type="MyNameSpace.Model, MyAssembly">
    <property name="DataFactory" ref="IDataFactory" />    
  </object>

</objects>

Then you can do:
public void Main(...)
{
    var ctx = new XmlApplicationContext("objects.xml");

    Model mdl;

    using (var file = File.OpenRead("mymodel.bin"))
    {
        mdl = ProtoBuf.Serializer.Deserialize<Model>(file);
    }

    ctx.ConfigureObject(mdl, "MyModel");

    // mdl.DataFactory will be injected with your idDatafactory instance
}

