Help with using MVC and Entity Framework
I have come here after getting some assistance in the news groups, but I am looking for help with my current Design in finding a suitable Design Pattern to learn, and maybe apply to my current project.
I am doing a small application for a non-profit group, more as a learning experience for my professional work. I am a .Net developer, but never really made use of any Design Patterns. I basically hand crafted my work. My goal is to see if I can improve my project with ER and MVC.. but also, to learn.
My current application has an established SQL Server database hosted on a popular hosting server. I have a WinForms application (C#, .Net 3.5) which is installed onto numerous user-desktops. They then contact a classic ASP.Net WebService (never used WCF..) hosted on the hosting company's server, which in turn, connects to my SQL Server database.
I have a ClassLib project which is shared between the WinForms app, and then WebService, which contains the definition of a 'CommRequest' objects. The object has a few properties, as well as a 'RequestParameters List<String>' and a 'ReplyParameters List<String>. The WinForms app populates the properties, as well as maybe adds a few parameters to the List<>. I then have one method in my WebService, called 'Request'. It accepts a CommRequest object, and then returns the same object, once the operation on the server is complete.
On the web service, I have a Database class, which handles database connections and executes stored procs. I then have a DataAccessor for each of the database entities. Within the web service, there is also a EntityObject for each database table. This is all generated using MyGeneration. So I make a table change, and then regenerate the DAL.
So, lets say the application makes a request to see if it's the latest version. I build a CommRequest, and pass it to the WebService... The Request method accepts it, works out what the reuqest is for, and then calls a Service Layer method ... Maybe 'FirmwareService.CheckLatestVersion()'. That then calles the DataAccessor... which calls a stored proc... and then the data goes back up to the service layer, which rebuilds the CommRequest.ReplyParameters and then returns the object to the WinForms app.
As far as I know, I am using no Patterns here...
I find it easy to maintain.. easy to debug.. and I have followed a KISS principle. However... maybe something like Entity Framework within the Web Service would make life easier, and use more industry friendly Patterns?
Basically, I am looking for someone/people to help me work out where my current design falls short, and maybe guide me in using a better Framework or Design Pattern for my application.
I also have a Web Page that makes use of the Web Service and that is starting to get new features. So, I'm trying to ensure I am sharing code well, and following a nice neat OO design.
I have attached some example code of my generated DAL stuff.
Craig Lister, Dec 27, 2010
You might want to take a look at my code generator. It creates n-Tier code based on your designs, but it does come with out-of-the-box code to generate standard n-Tier frameworks, or frameworks based on the Patterns In Action framework.
But this code generator generates an infrastructure that is scalable and easy to maintain, and you can create your own framework for future applications that you build. So it could be a good place to start if you want some examples on how to build a good n-Tier framework.
Did I mention it's free and you have access to all the source code? It uses the MyGenerationSoftware code generation tool for generating the code (which is also free).
Here are some videos so you can see what it is and what it does.
King Wilder, Dec 31, 2010