3 Tier Winform Application
I have a college project that I want to do as 3 Tier Winform Application so that I need only to update my application at one place (ie the server). Does anyone have suggestion on how to do this? I have to work with a client machine, and a fairly good server. I want the server to house the Database and the Business Logic, and want the client machine to开发者_C百科 be a thin client.
Write your winform (not quite a thin client though) as you normally would. We'll call it thin cause it wont to any heavy lifting, just UI logic. Rather than make references to your business and data assemblies, create an agent class that you will reference from your winforms app. Then the Agent will have the implementation to talk to the back end, and your front end will not know how the communication happens. Then create a Service Contract class (that will expose the interfaces to the front end) in a separate project. The Agent will use this contract.
Since you are in VS2005, i assume you have the .net framework 3.0 extensions installed, but not 3.5. You can use WCF to communicate to the back end Server, where your interfaces will be exposed to be called by the agents.
If you want to stay away from WCF, you could also use .net remoting, but that may be a little more difficult to configure, and it typically not the preferred transport mechanism over WCF.
So it would look like this:
Client Tier
Winform
Agent
Business Tier
Service Contract
Business Components
Data Access
Database Tier
Database
Here is a article that kinda describes this pattern.
Try looking into the CSLA.NET Framework, it's a Use Case oriented way of implementing your business logic. Comes with UI binding, network communications, and other features like unlimited undo straight out the tin.
Also comes with a book, which teaches you how to use it - worth a read. It's a very well implemented framework and remains active - though, like me, you might find it a little shift from how you usually program.
The networking capabilities allow you to host an app server, but have that part transparent to the UI. It adheres to the idea of n-tier, but in a slightly different manner.
精彩评论