private Entity GetResult() { Entity result = GetEntity(); foreach (var item in Items) { var property = EntityType.GetProperty(item.Name); var propertyView = PropertyViews .Where(x => x != null) .Single(x => x.Property.Name == property.Name); if (!propertyView.IsValid) { throw new InvalidInputException(item); } property.SetValue(result, propertyView.Value); } switch (Mode) { case Modes.Creating: if (PostCreated != null) { PostCreated(result); } break; case Modes.Updating: if (PostUpdated != null) { PostUpdated(result); } break; default: throw new NotSupportedException(); } return(result); }
private TView GetView <T, TView>() where TView : class { return(PropertyViews.SingleOrDefault(x => x.Property.Type == typeof(T)) as TView); }
private PropertyView GetView <T>() { return(PropertyViews.SingleOrDefault(x => x.Property.Type == typeof(T)) as PropertyView); }