public MainWindow( IRailsEditViewFactory railsEditViewFactory) { railsEditViewFactory = railsEditViewFactory.Resolve(); InitializeComponent(); var result = Try.To(() => SaveFilePath.DeserializeFromJson <BookShelf>()); if (result.Ok) { this.bookShelf = result.Value; } else { CreateSampleData(); } this.BookShelfGrid.Children.Add(railsEditViewFactory.CreateEditView(bookShelf, typeof(BookShelf))); }