T.C.
T.C.

Reputation: 215

Please Confirm My Understanding of WCF/WPF Structure

I'm studying WCF and WPF. I've learned a lot by doing sample projects, but I'm having trouble putting everything together. It would help if I could paraphrase my understanding of proper WCF/WPF structure and invite others to confirm or correct my ideas. Here is a very broad description of how I expect my next project to work:

My persistent data will be stored in a SQL Server database. I will create a WCF Service Library which serves as an interface to the database, solving security issues and recasting the relational data into an object-oriented entity model. My application will read data through the WCF service into a memory structure which might be customized somewhat for the needs of my application, but will basically consist of one ObservableCollection for each of the entities in my data model. Because the data will be stored in ObservableCollections, I will be able to use event procedures to respond to data changes that trigger business processes. Simple user interface elements will bind directly to the collections. More sophisticated user interface elements, like a TreeView, will require another layer, called a PresentationModel or ViewModel. In the case of a TreeView, the TreeView will bind directly to the PresentationModel, and the PresentationModel will bind directly to the collections.

Have I described everything correctly?

-TC

Upvotes: 5

Views: 340

Answers (3)

BenjaminPaul
BenjaminPaul

Reputation: 2931

I would definately make use of the MVVM pattern, allow a ViewModel to expose your collections and properties that your UI binds too, you seem to have a grasp of that pattern from what you have described.

Upvotes: 2

Josh Smeaton
Josh Smeaton

Reputation: 48710

Is WCF really required for your data layer? Have you looked into Entity Framework at all?

Simple user interface elements will bind directly to the collections.

I'd advise slightly against the above. A decent model to follow is the MVVM (Model-View-ViewModel) pattern. It sounds like you've read a bit about this considering your ListViews are going to be contained in a ViewModel. I would also have your raw data models exposed to a ViewModel, and have your View bind to that. So, for your raw data models, use them like you intend to do with ListViews.

Other than that, sounds like you're spot on.

Upvotes: 1

Robert MacLean
Robert MacLean

Reputation: 39261

There is nothing technically wrong in what you wrote.

Things that feel off:

... solving security issues...

Scares me because it implies, to me at least, that you will have no security issues. I would have phrased it as

provideds a centralised system for authentication and authorisation to the data from all interfaces

Upvotes: 3

Related Questions