C# Class Ncqrs.Eventing.Storage.PropertyBagConverter

Converts an IEvent from/to a flattened structure suitable for storing in an IEventStore.
Inheritance: IPropertyBagConverter
显示文件 Open project: SzymonPobiega/ncqrs Class Usage Examples

Public Methods

Method Description
AddPostConversion ( Type targetType, IPropertyBagPostConverter converter ) : void

Adds a custom converter that resolves differences when converting an event or command with an earlier schema.

Convert ( object obj ) : PropertyBag

Converts a command or event into a property bag.

Convert ( PropertyBag propertyBag ) : object

Converts a command or event stored as a property bag back to its object representation.

If a post conversion was registered using AddPostConversion, it will be invoked after the default conversion has completed. Moreover, the actual type created can be overridden by providing a custom IPropertyBagTypeResolver through the TypeResolver property.

Private Methods

Method Description
CreateInstanceOfType ( Type targetType ) : object
GetDestinationType ( PropertyBag bag ) : Type
InitializeInstancePropertiesFrom ( PropertyBag bag, object target ) : bool
InvokePostConverter ( object instance, PropertyBag bag ) : bool
IsPropertyWritable ( PropertyInfo propertyInfo ) : bool
RequiresConversion ( PropertyInfo targetProperty, object value ) : bool
SetPropertyValue ( object instance, PropertyInfo targetProperty, object value ) : bool

Method Details

AddPostConversion() public method

Adds a custom converter that resolves differences when converting an event or command with an earlier schema.
public AddPostConversion ( Type targetType, IPropertyBagPostConverter converter ) : void
targetType System.Type The type of command or event for which to a add custom post conversion.
converter IPropertyBagPostConverter The converter object that will resolve the differences.
return void

Convert() public method

Converts a command or event into a property bag.
public Convert ( object obj ) : PropertyBag
obj object
return PropertyBag

Convert() public method

Converts a command or event stored as a property bag back to its object representation.
If a post conversion was registered using AddPostConversion, it will be invoked after the default conversion has completed. Moreover, the actual type created can be overridden by providing a custom IPropertyBagTypeResolver through the TypeResolver property.
public Convert ( PropertyBag propertyBag ) : object
propertyBag PropertyBag
return object