예제 #1
0
        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);
        }
예제 #2
0
 public static void AllowDependencyInjection(this ViewModelSerializationMap map)
 {
     map.SetConstructor(ActivatorUtilities.CreateFactory(map.Type, Type.EmptyTypes));
 }
예제 #3
0
 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}'.");
예제 #4
0
 public static void SetConstructor(this ViewModelSerializationMap map, ObjectFactory factory)
 {
     map.SetConstructor(p => factory.Invoke(p, new object[0]));
 }