public static ViewModelPropertyMap Property(this ViewModelSerializationMap map, string name) { var r = map.Properties.SingleOrDefault(p => p.Name == name); if (r == null) { throw new InvalidOperationException($"Property '{name}' was not found on '{map.Type}'."); } return(r); }
public static void AllowDependencyInjection(this ViewModelSerializationMap map) { map.SetConstructor(ActivatorUtilities.CreateFactory(map.Type, Type.EmptyTypes)); }
public static ViewModelPropertyMap Property(this ViewModelSerializationMap map, string name) => map.Properties.SingleOrDefault(p => p.PropertyInfo.Name == name) ?? throw new InvalidOperationException($"Property '{name}' was not found on '{map.Type}'.");
public static void SetConstructor(this ViewModelSerializationMap map, ObjectFactory factory) { map.SetConstructor(p => factory.Invoke(p, new object[0])); }