/// <summary> /// Generates a collection of nested details for a model /// </summary> /// <param name="model">The model</param> protected virtual void GenerateNestedDetails ( object model ) { var properties = model.GetType().GetProperties ( BindingFlags.Public | BindingFlags.Instance ); properties = properties.Where ( p => p.CanRead ) .ToArray(); foreach (var property in properties) { var detail = new DomainEventLogDetail ( this, model, property ); this.NestedDetails.Add ( detail ); this.HasNestedDetails = true; } }
/// <summary> /// Generates a collection of nested details for a string collection /// </summary> /// <param name="propertyName">The property name</param> /// <param name="collection">The string collection</param> protected virtual void GenerateNestedDetails ( string propertyName, IEnumerable <string> collection ) { var index = 0; foreach (var value in collection) { var itemName = String.Format ( "{0}[{1}]", propertyName, index ); var detail = new DomainEventLogDetail ( this, itemName, value ); this.NestedDetails.Add ( detail ); this.HasNestedDetails = true; index++; } }
/// <summary> /// Populates the domain event logs details /// </summary> /// <param name="event">The domain event</param> protected void PopulateDetails ( IDomainEvent @event ) { Validate.IsNotNull(@event); var properties = @event.GetType().GetProperties ( BindingFlags.Public | BindingFlags.Instance ); properties = properties.Where ( p => p.CanRead ) .ToArray(); foreach (var property in properties) { var detail = new DomainEventLogDetail ( this, @event, property ); this.Details.Add(detail); } }
protected internal DomainEventLogDetail(DomainEventLogDetail parent, string propertyName, string propertyValue) { Validate.IsNotNull(parent); Validate.IsNotEmpty(propertyName); this.LookupKey = new EntityKeyGenerator().GenerateKey(); this.NestedDetails = new Collection <DomainEventLogDetail>(); this.Parent = parent; this.Log = parent.Log; this.PropertyName = propertyName; this.PropertyStringValue = propertyValue; this.PropertyTypeName = nameof(String); }
/// <summary> /// Constructs the domain event log detail /// </summary> /// <param name="parent">The parent log detail</param> /// <param name="model">The model</param> /// <param name="property">The property information</param> protected internal DomainEventLogDetail ( DomainEventLogDetail parent, object model, PropertyInfo property ) : this(parent.Log, model, property) { Validate.IsNotNull(parent); Validate.IsNotNull(model); Validate.IsNotNull(property); this.Parent = parent; }
protected internal DomainEventLogDetail(DomainEventLogDetail parent, object model, PropertyInfo property) : this(parent.Log, model, property) { this.Parent = parent; }