WPF + MVVM + Nhibernate : A simple example? - wpf

I'ma rookie and MVVM NHibernate. No I'm doing a project with MVVM and NHibernate. I need an example to facilitate studying.
Thank you very much!

There are plenty of examples around for using both, they should be easy to find with [your favorite search engine]. It is better to ask specific questions rather than asking for beginner tutorials (which there are, as i said, plenty to be found).
For starters:
Good MVVM Introduction
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
NHibernate Article by the makers
http://msdn.microsoft.com/en-us/magazine/ee819139.aspx
Another article on codeplex that might be useful (WPF + NHibernate)
http://www.codeproject.com/KB/WPF/WpfNhibernateToolkit.aspx
Another SO discussing about Nhibernate, MVVM, WPF, aso
Using Unit of Work design pattern / NHibernate Sessions in an MVVM WPF

There is a very nice article (with sample code) using WPF.
Building a Desktop To-Do Application with NHibernate
It does not use MVVM however, but MVVM relies heavily on DataBinding and the approach followed in the article is quite similar (I could say, even better).

Related

WPF Desktop application and design patterns

I have to develop a desktop application and the back end will be SQL Express.
I am new to wpf.
Any design patterns i can use? any sample application for wpf with db?
Please help me.
Prism 4 is by Microsoft Patterns and Practices team and it advocates MVVM, Dependency Injection, and modular application development. The book (which I bought and read) is now free online. The book covers several design practices and should be a fairly good start to everything you would need to know to write maintainable, testable, flexible applications in WPF. Prism is also a framework which aids in modular app development and MVVM. It is also fairly popular.
Prism 4.1
^ Seriously, read this book. It takes 2 days max.
As per my suggestion MVVM pattern would be nice if you use in your application. Because it has many ways to reuse your code.
You can find tutorial on the same at below links:
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
http://www.codeproject.com/Articles/126249/MVVM-Pattern-in-WPF-A-Simple-Tutorial-for-Absolute
http://wpftutorial.net/MVVM.html
Let me know if you need more help.
You can use MVVM design pattern, It will help you to Reuse of code, Flexibility and Customization, Separation of the UI design and development , Testing ...
Refer these article to understand the MVVM pattern and also for sample WPF application..
http://www.codeproject.com/Articles/278901/MVVM-Pattern-Made-Simple
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
http://msdn.microsoft.com/en-us/library/gg405484%28v=pandp.40%29.aspx

Retired Content Model View Presenter on MSDN

I am learning to develop windows forms application with Entity Framework using Model View Presenter pattern, since it is the suggested design pattern for windows forms development on stackoverflow. On the other hand, there is a 'retired content' note on every article about MVP, on MSDN.
This is quite confusing, as I don't whether I should continue learning about MVP and try to implement it in windows forms development or there is another better design pattern that I should follow.
Any suggestion?
links:
http://msdn.microsoft.com/en-us/library/ff647543.aspx
http://msdn.microsoft.com/en-us/library/ff649820.aspx
For WinForms you should stick with MVP (Supervising Controller).
The reason you are seeing retired content is because Microsoft is heavily invested in the new Windows 8, Metro Style applications. WinRT built using C++, C# and WPF, or HTML5 + JavaScript are going to be what you will build applications in going forward, so it makes sense to learn at least one of those.
WinForms isn't officially deprecated, but don't expect it to get a lot of love from MS. I would spend some time learning XAML, and the MVVM pattern. That being said, the concepts for all UI design patterns (MVC, MVP, MVVM) are all very similar, so learning one will help you understand the others.

MVVM Silverlight Framework Choices

Which Silverlight MVVM Frameworks should I look at - taking into account these areas of functionality.
1) IoC - can I choose my own? I would like to avoid using MEF w/ Attributes.
2) Navigation
3) Callback simplification
4) "IMessageBox" type abstractions
5) Testability
6) Logging
Note: mitigating a conversion to full-blown WPF is not a concern. This app will always be only Silverlight.
What other things haven't I thought of?
Any good online references that compare and contrast the current frameworks?
I personally like Prism, but you can find a comprehensive list of many frameworks/libraries with features comparison here.
I hope this helps.
Thanks,
Damian
PRISM (this is the mainpage). Here is some information about what it offers. Here is what Microsoft has to say about it.
Just a quick side note, I know this doesn't answer your question and so on.
Someone (Josh Smith) once said that MVVM has nothing to do with IoC; so any MVVM framework that forces you to use a specific IoC framework does something wrong in my opinion.
Also, testability is innate to MVVM but only if you do your job of structuring your Model and ViewModel accordingly. So a MVVM framework should never restrict this, it's all up to you.

Learning WPF and MVVM - best approach for learning from scratch [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I've got about three years c# experience. I'd like to learn some WPF and the MVVM pattern.
There are a lot of links to articles on this site but I'm getting a little overwhelmed.
Would a sensible approach for a begginer to be forget mvvm for a while and just quickly learn a bit a of WPF, then come back to MVVM?
I had a leaf through Application=Code+Markup - Charles Petzold in work today, it doesn't seem to mention MVVM (at least not in the index). I was pretty surprised by this as I thought MVVM was supposed to be the "lingua franca" of WPF?
Also I've just started working at a new company and they are using MVVM with WinForms, has anyone come across this before?
Can anyone recommend a book that will teach me both WPF and MVVM?
It depends on your experience.
I personally felt that this was a lacking area in MVVM discussions, which was what led me to write my series on MVVM and WPF from a Windows Forms developer perspective.
I would not try to learn WPF without learning MVVM. You'll end up trying to "unlearn" many aspects, as WPF really doesn't make sense, completely, until you understand the separation of presentation and logic that's pervasive throughout the architecture. MVVM is really just extending this same separation into the application space.
As for "MVVM in Windows Forms" - a lot of people try to do this, but it's not really MVVM. In order to do "MVVM" you need access to a richer form of data binding than Windows Forms provides. "MVVM in Windows Forms" is really, typically, just Model-View-Presenter with a different name (riding the MVVM bandwagon, I'd guess), but not really the same as MVVM in WPF.
Jason Dolinger has an excellent video on the subject. It steps you through the process moving from using code behind files to a full MVVM pattern including Dependency Injection and Testing.
Bill Steele did a 16 part "Soup-to-Nuts" webcast series on WPF. The links on the msevents site are broken. Here is a Google search to find them. This will help with the WPF learning curve. And he does NOT use any MV* patterns in his examples.
EDIT: The MSEvents links are working now, I am leaving the Google search as a backup.
Josh Smith also has an excellent article WPF Apps With The Model-View-ViewModel Design Pattern on MSDN.
Herding Code:
Presentation Patterns with Jeremy Miller, Ward Bell, Rob Eisenberg and Glenn Block
Part 1
Part 2
MIX10:
Laurent Bugnion Understanding the
Model-View-ViewModel Pattern
Rob Eisenberg Build Your Own MVVM Framework
And of course Reed Copsey's MVVM articles are worth a read as well.
I was told a few times that my MIX10 session was explaining the MVVM pattern well enough for beginners (even though some parts are actually quite advanced, so don't worry if you need to re-watch certain parts).
The session is at http://live.visitmix.com/MIX10/Sessions/EX14
Sorry for the self-promotion.
Cheers,
Laurent
There aren't many books covering MVVM but there is one : Advanced MVVM
But there are lots of online resources and this one is a must read : WPF Apps With The Model-View-ViewModel Design Pattern
After that I suggest looking into frameworks like
MVVM Light Toolkit
Caliburn
To do big things (like learning WPF + MVVM) it is better to break the task in smaller steps.
I think that the best approach in this situation is to start by learning the UI part of Wpf. Learn XAML syntax, the layout system, the available controls and forget about binding and how to deliver data to the controls.
Once you know the UI basics of Wpf then it is time to move to MVVM. Learn how bindings work and the MVVM pattern.
In this Web you can find a tutorial focusing on the hands on but with the theory available:
http://www.learnmvvm.com
Here is a tutorial for MVVM http://www.codeproject.com/Articles/819294/Learn-WPF-MVVM-step-by-step-Basics-to-Advance-Leve which goes from basic to the advance level in 5 steps. So its like graduating from a 3 layer to full MVVM.
Try this site. It collects the various resources at one place.
http://learnandmasterwpf.blogspot.com/
I just read this book. It is not really about learning WPF, but it should be useful once you already know a bit of WPF and want to progress your understanding of MVVM.
http://www.amazon.co.uk/Pro-WPF-Silverlight-MVVM-Model-View-ViewModel/dp/1430231629

Do you know any real-world, useful WPF/Silverlight applications using MVVM?

I'm looking for code of full applications that (1) use the MVVM pattern and (2) are approachable for WPF/Silverlight/MVVM beginners. So far I have only found:
Crack.NET - A runtime debugging and scripting tool (useful but quite complicated)
CipherText - WPF Password Manager (perfect but written in VB.NET)
What are some others?
preferably smaller helper apps or tools that use MVVM but that have a completed feel, perhaps with WPF/Silverlight graphic/animation goodness, etc. which show not only the MVVM concepts being used but in a context of a real-world, completed application
My Contribution
Thanks for all the tips, I collected together a list of 15+ MVVM code examples and posted the here:
Overview of WPF/Silverlight code examples that help you learn MVVM.
I too class myself as a beginner in MVVM developing a large scale application for about a month now. I'm over most of the main hurdles, but keep getting confused up by a few things.
Be careful with the suggestions from Kent. They'll get you started, but the subtle differences in Silverlight and WPF will trip you up occasionally (triggers are one).
I don't know of any full sites, but I started with the Composite Application Guidance and PRISM libraries. These a little too cumbersome for a 'beginner' and just MVVM, but some of the concepts are very useful (event aggregator for example).
I suggest that you read blogs by Josh Twist, Josh Smith, Shaun Wildermuth and Nikhil Kothari. These guys are very knowledgeable. They are also very open to answering questions too.
What is your development background? Some of the concepts surrounding method calls, responses and delegation are a real break from "traditional sequential" coding techniques.
Given the question, you may be interested in the current effort going on to create a "Pet Shop" type reference implementation for M-V-VM. You can join the conversation or follow progress here.
I've been using MVVM for the last couple of months on a project and it's been fantastic. I've been doing UI work for over 12 years and it's the best thing I've come across.
I have been using MVVM for about 2 years now, and I can say that it is a resounding success. I have shipped one large-scale medical imaging solution using MVVM in Silverlight. I am also about to ship a complicated WPF application using Prism and MVVM extensively. In fact, I don't know how I'd achieve some of my problems elegantly without MVVM in this more recent application.
+1 on MVVM. It works. It is testable. It is extensible. It facilitates developer-designer workflows. It ALSO doesn't have to be messy and plumbing-heavy.
In addition, I created a medium-sized Silverlight application using MVVM for the CodeMash conference in January. You can see it and get the source code here.
Try this one. Also, Family.Show may be useful.
The WPF Disciples group has decided to create a real-world MVVM + Mediator reference application similar to the Pet Shop refence application for Web Apps. Your can follow the development on codeplex here

Resources