private Type?GetEventArgumentType() { if (EventPath == null || !EventPath.IsValid) { return(null); } // Cannot rely on EventPath.GetValue() because part of the path might be null Type eventType = EventPath.GetPropertyType() !; return(eventType.IsGenericType ? eventType.GetGenericArguments()[0] : typeof(DataModelEventArgs)); }
private void CreateValueChangedEventIfNeeded() { Type?propertyType = EventPath?.GetPropertyType(); if (propertyType == null) { return; } if (!typeof(IDataModelEvent).IsAssignableFrom(propertyType)) { IDataModelEvent?instance = (IDataModelEvent?)Activator.CreateInstance(typeof(DataModelValueChangedEvent <>).MakeGenericType(propertyType), EventPath); _valueChangedEvent = instance ?? throw new ArtemisCoreException("Failed to create a DataModelValueChangedEvent for a property changed data model event"); } else { _valueChangedEvent = null; } }