views:

239

answers:

4

The title tells it all, I need to see how others solve this to get a grasp around it. WebForm applications won't help me, as I don't understand WebForms and it would really confuse me (if possible) even more.

If such a example or framework would fit together with Entity framework it would rock my world.

Edit - Added some info:

WinForms I know well, and that's why I'm hoping for an example that I can relate to.

I have trouble understanding how to get the different structures from my model to my user. Getting plain data from the model is piece of cake, and passing events from Form back to my 'controller' is also easy, so the model gets it's data.

For one model of data I've ended up with 5 different DTO objects as they need different additional data. If this is representing for my solution, I'll end up with about 40 different view interfaces, and then it's becoming difficult to even name them.

So by seeing how others have solved my issues I hope to nail out my own solution on the problem, because right now I'm uncertain if I've missed something and is doing it all wrong.

+1  A: 

There are some who will disagree that this is multi-tier, but it will show you separation of concerns and techniques for decoupling the layers.

koossery.MVCwin: an MVC open source framework for winform .NET applications http://koosserymvcwin.codeplex.com/Wiki/View.aspx?title=koossery.MVCwin%20Overview&referringTitle=Home

There is also this article, with examples in Winforms:

The Entity Framework In Layered Architectures
http://msdn.microsoft.com/en-us/magazine/cc700340.aspx

Robert Harvey
I really liked the Entity example. I see now that I'm not too far off, but that I might need to reconsider my complexity... Thanks. :)
rozon
+2  A: 

A good easy place to start would be writing a WinForms (not WebForms) client that communicates with a .NET web service passing some basic data back and forth. Try figuring out caching strategies both on the client and server. Get familiar with the referencing web services and proxy classes. Think about validation and error handling.

Once you are comfortable with how a basic web service works, take it to the next level and read this book Expert Business Objects by Rockford Lhockta. The book takes you through creating n-tier business objects and all the issues you will face when developing them. He develops an n-tier framework that serves objects to client, web and service applications. Believe me, it's no small feat.

Good Luck!

Steve
+1 for incremental approach.
djna
A: 

It's not clear to me what your problem with understanding n-tier architectures might be? Sounds like you've looked at WinForms and found it initimidating. Is that from the point of view of how to make something happen in WinForms? Or from the point of view of why one might use an n-tier architecture in general.

A problem in studying Frameworks is that they represent the fruits of much careful thought and careful design (we hope :-). They tend to intentionally hide much complexity ... put your code here, and here, trust us, we'll look after the rest ... so if you're trying to learn why you need to understand an awful lot of the internals of the framework. That's really a big ask for those of us with conventially sized brains.

So at the general level, have you looked at articles sych as this?

If you're past that then I think you need to be patient and spend time in considering each tier. Part of the point of n-tier apps is that each tier can be considered as a separate problem. It's quite an ask to understand everything from Javascript in a Rich UI to SQL and stored procedures, and all the tiers in between. So be prepared to work on each one in turn.

You say you don't understand WinForms. Do you think other frameworks will be substantially easier? Suppose you work through a tutorial such as this at what point do you encounter a difficulty?

djna
+1  A: 

Check out the patterns & practices Application Architecture Guide 2.0. Pretty good, compreshensive, free. :) It relates to a sample project Layered Architecture Sample for .NET.

JP Alioto
That was actually very helpful. I'll dive into this when I get more time on my hands.
rozon