This project has moved. For the latest updates, please go here.

Get Started

Dec 1, 2014 at 1:09 AM
Hi,

I find the concept very interesting but i really don't know where to start. UnitTest are not self expressed and i can't find any docs.

Can you send me a sample realistic project or any doc to start.

Regards
Coordinator
Dec 3, 2014 at 7:45 AM
Hi,

The unit tests are probably less useful for learning about features than the integration tests, but I agree that we could use some more documentation and samples :)

In principle, there are two use cases you can use the TypePipe for.
  1. you can use it to construct objects of a given type, having several components participate in extending that type with additional features (by collaboratively creating a subclass proxy), or
  2. you can use it as an infrastructure to build new types from scratch.
The former is the main use case, so I assume this is what you want to try out. For this, you first need the participants you want to take part in extending types. You do that by implementing IParticipant (or by deriving from SimpleParticipantBase). That interface has a method "Participate", which receives an IProxyTypeAssemblyContext instance that a concrete participant uses to extend the generated type (e.g., by calling context.ProxyType.AddMethod(...)). Take a look at re-motion's DomainObjectParticipant or the much more complex MixinParticipant to see some real-world examples.

After you have implemented all the participants that will collaborate on extending the types of created objects, you will need an instance of IPipeline in order to actually create those objects. You can use an instance of DefaultPipelineFactory to construct one. Its "Create" method takes the list of participants and a PipelineSettings object (you can probably use "PipelineSettings.Defaults") as well as a "participantConfigurationID". The latter is a string that identifies the set of participants you're using. That identifier is used for serialization and deserialization of objects created with the TypePipe, and its contract is that two IPipelines with the same "participantConfigurationID" must create equivalent subclass proxies when called for the same original type.

That's it, you can now use the IPipeline's "Create" method to create instances of types extended by your participants. There are a few advanced concepts and features, such as "partial type identifiers", "additional types", the PipelineRegistry, deserialization, the different PipelineSettings, and so on, so feel free to ask on this list if you have any questions regarding those.

Best regards,
Fabian
Developer
Dec 5, 2014 at 11:12 PM
Edited Dec 5, 2014 at 11:12 PM
There is also a simple demo project which should be easy to follow (it only uses the basic features of TypePipe).
https://github.com/yln/TypePipeDemo