Simple CRUD application in WPF
I am working to create a simple CRUD application in WPF which will work Entity Framework and a CE database. Since its only a UI to be used for testers to manipulate the DB, it doesnt have to be production level code.
Still I want to开发者_如何学Python use design patterns to make it easily maintainable for the future. Do you think a MVVM pattern would be overkill for such an application?
Any other suggestions for creating the UI in an easy way?
Simple MVVM would be great BECAUSE it is simple appication. You can manage 2-3 windows right from your models without worrying to get a conceptual mess. I've just implemented one(~1000 lines of code) using MVVM, no regrets. Easy to extend, easy to suport. Go for it :)
If you're looking to get something up and running very quickly, while still using good design patterns I would recommend you use Caliburn Micro. Caliburn is a light and efficient MVVM framework for building WPF & Silverlight applications that uses a convention based approach.
So for example if you have a button in your view called DoSomething
<Button x:Name="DoSomething">Something</Button>
and a method on your ViewModel called DoSomething()
public class MyViewModel
{
public void DoSomething()
{
..//Action Code Here
}
}
Caliburn will automatically ensure that the method on your ViewModel gets called when the button is clicked. It will also take care of binding input controls such as textboxes on your View to properties on your ViewModel using an identical convention based approach.
<TextBox x:Name="OrderNumber"><TextBox>
public class MyViewModel
{
public string OrderNumber
{
get { ... }
set { ... }
}
}
I find that this really speeds up development. There are also a number of tutorials on Codeplex to get you started.
精彩评论