i search a lot google and found many article for CRUD operation with MVC but most of them was for asp.net. i was looking for CRUD operation code in c# with MVC in win application as a result i can see their flow and understand how they are developing their layer in MVC. if anyone know about the url from where i can have sample code for RUD with MVC for win form then please let me know. thanks
Here is a sample that I put together of one way to handle CRUD in an ASP.NET MVC application.
http://gpsnerd.codeplex.com/
In this example, the CRUD is handled by a Repository pattern. Let me know if you have any questions.
Bob
Did you check
1. Rocket Framework
Though it is not fully MVC, it is developed with n-tier pattern which seems good for any enterprise system..
Please talk to the project owner or check the code before making any commitment to use it with high volume enterprise scale systems
Related
Bit of a beginner question, but I'm currently building an ASP.NET MVC web app and I would like to transfer my models and data across to a Windows Universal App to begin with and then maybe a Xamarin app in the future.
Are there any good tutorials or blog posts out there that anyone can recommend that would help me. The idea is that the user will have the same experience across web and mobile so I don't want to hard code models for each client.
To do this you will need to split your domain model into different projects.
When you create your MVC application create a new C#/VB.NET assembly and place all of your models in the assembly. This way you can reuse the code across multiple projects.
Keep in mind that you shouldn't just dump code into this assembly take the time and create a proper namespace structure so that you don't confuse yourself or anyone else later on down the road.
I want to create an application which i want to work both on web and windows for which i want to make seperate presentation layer. first of all i want to know, Is MVC is only for web applications?
By all means no. Check out this quote from http://blog.iandavis.com/2008/12/09/what-are-the-benefits-of-mvc/
The Model/View/Controller (MVC) triad of classes [first described by
Krasner and Pope in 1988] is used to build user interfaces in
Smalltalk-80.
When I was in graduate school we used MVC for Java apps...
Not necessarily only for web, depends on how you use it. It's just a framework that should work on both. Example, iOS development is also done on MVC style. But if you're using WPF/Silverlight, you should look at MVVM rather than MVC.
As far as i know MVC gives you more command over building the html. User MVC if you want a clean and more controlled html output. if you are developing a business application set-up a a solution and DAL and other business logics layers in class library type projects and then build separate user interfaces for both web and desktop. ASP.NET will be best if you don't want more control over output HTML.
I'm developing an ASP.NET MVC 3 website that can manage my budget and expenses. It's almost done. So, I have my models, my views, repositories and controllers, and these two last have some important logic, about how to find and return searches and about business logic. OK, so far so good.
But, I'd like to develop and Windows Phone 7 App where I want to make avaiable some part of the features the site will offer, so I could use the exact same controller action that the ASP.NET MVC 3 site have, but I don't have a clue about how to do it.
I never worked with WP7 development, I know it is Silverlight-based, I know a little WPF and Silverlight, but I don't know how to glue my business logic that already exist in my controllers and repositories with the app. I know I can consume Web Services with Silverlight, but then I would have duplicated logic, in my actions and services? How I can handle this? Is there any resources that can help me through this learning process?
What I want, actually, is a way to reuse everything I already have, without duplicating the logic, or, at least, make only small adjustments.
Thanks for the help and sorry if my english isn't clear enough.
Try watching the video series The Full Stack on Channel 9. In the series they build an MVC site with a WP7 companion app.
http://channel9.msdn.com/Series/The-Full-Stack/The-Full-Stack-Part-1-Building-the-Admin-Site-with-ASPNET-MVC-3-NuPack-and-EF-Code-First
You should not program your business logic into your controller. Controllers are part of the user interface and setup the data for the views which are purely web based.
Therefore you cannot reuse your controllers in Silverlight, but you could use your business logic and implement a service interface for the Silverlight application which runs in the browser. If you used Entity Framework you could use the wcf services.
Before you start thinking about Silverlight you should learn XAML and WPF, then Silverlight and last but not least WP7 (which is mainly SL3 based plus some phone specific add-ons).
The other option you have: you use your web application and use the html interface on your phone 7 the same as on your webbrowser. The next release of phone 7 os supports html 5 as well.
I'm writing a Windows version of my Mac app (C# Winforms) and would like some advice on what design pattern to use.
My Mac app uses an MVC pattern with Core Data for storage. This is a simplified diagram of the models and relationships:
The desktop app collects logs on a background thread and periodically uploads them to my web app. The database is used to store both the user's account information and logs, and the app has a 3 views to display (and collect) the user's data.
I've done some reading and it seems that MVP is the recommended design pattern for WinForms apps, but I'm not sure how to proceed from here. I think that my app is simple enough to write without using an external framework like MVC# but as I have never made a WinForms app before I am only speculating.
Can someone recommend the best way to go about this?
Patterns are really just guides as to what problem it is trying to solve. Where an MVC would work well for a web app that relies on pages and redirects etc a winform app can benefit from using MVP.
Having said that the two patterns are siblings of a wider UI pattern and even according to Martin Fowler the MVP pattern can be further split. Look at his article to get a good feel for the appropriate pattern. He has broken the MVP to Supervising Controller and Passive View. Even the new MPF MVVM pattern is actually based on the PresentationModel pattern.
I would say look at the patterns and see what fits rather than trying to use a pattern because you used it in another scenario.
In my experience for a winforms application (which supports nice databinding) you can use MVC with a supervising controller pattern. Read through this question What are MVP and MVC and what is the difference? & http://codebetter.com/jeremymiller/2007/05/25/build-you-own-cab-part-3-the-supervising-controller-pattern/
You should take a look at Jeremy Miller's Build your own cab series :
http://codebetter.com/jeremymiller/2007/07/26/the-build-your-own-cab-series-table-of-contents/
Start to work on it, do some screen mockups, do some design, write some code.
You could start with a few small prototype, try out different design. Don't go too far in your exploration phase so that you don't hesitate to throw it away and start over if you need.
Try to keep your choice open as much as possible, don't paint yourself into a corner, and delay this decision until your really need to choose one way over another.
By then you will probably have a much better Idea of what you need.
I'm developing a website , job portal. I have 2-3 years of ASP.NET webform development experience,
I want to create a professional job portal site (to improve and learn more) but trying to decide on best architecture. Any suggestions or advice will help...
Thanks
Well, there are a number of ways to answer this question, and I'm sure many others will chime in. I'll just say that since your goal is to improve and learn more, and you already have 2-3 years of webform experience, this might be a good opportunity for you to learn MVC. Then you will have experience in both, and can make more informed decisions regarding the best architecture for future projects.
Happy learning!
Whilst nobody can tell you exactly what to do, the team I manage is about to release a new CMS / Job portal using ASP MVC. MVC gives us excellent testability and scalability out of the box and it can be quickly combined with tools such as nHibernate / windsor (IOC) / nCache / jQuery - this ensures that you have a wealth of resources on the internet to help accelerate your development and skill. You can also embrace standards such as XHTML 1.1 strict, which is almost impossible with ASP.Net webforms due to the auto generated HTML
1 other advantage is that you also get away from the dreaded ASP.Net viewstate.
Use ASP.NET MVC if you want to:
learn the ASP.NET MVC framework
use jQuery or similar libraries
really learn web-languages (HTML, CSS, JavaScript)
use Test Driven Development
have a clean separation of concerns
If you don't have the time or will to learn to use the ASP.NET MVC framework correctly, stick with ASP.NET WebForms.
My answer is almost always "ASP.NET MVC." The amount of flexibility and features and testability and maintainabilty and ... heavily outweigh WebForms.
WebForms has the advantages of a rich ecosystem of existing controls and documentation, and is really powerful for some kinds of tasks (complex, multi-form interactions), but I find its limitations get in the way far too often. You have to mold yourself to it.
It really depends on what the end goal of the application is. As Scott Ewers said, if your goal is to learn, then using ASP.NET MVC will expand your breadth of knowledge in the ASP.NET space (since you already know web forms).
Additionally, if this is going to be a public product, you can leverage the testability benefits of MVC and run automated unit tests. Key ideas like Separation of Concerns can also increase long-term scalability and maintainability.
The primary reason why you might choose web forms is if you are rapidly prototyping the job board application. As you know, web forms allows you to drag-and-drop components onto the canvas to quickly create some basic data entry functionality.
There is a herding code podcast from May 13 on the subject.
Herding Code 47: Joe Brinkman on Webforms vs ASP.NET MVC.
I also agree that choosing MVC would have the advantage of allowing you to expand your knowledge. That not being the only reason, given the choice as well I just finished a small MVC project (my first) and let me tell you MVC rocks! Its a great framework which I feel gives you more flexibility and at the same time out-of-the-box tools to create a web app quickly and painlessly. It was my first experience with VS2008 & .NET FW 3.5 & LINQ, and all the guides at www.asp.net helped me go forward quickly (especially the free tutorial chapter from an MVC 1.0 book mentioned here).
I also got to learn JQuery along the way, as it is very much integrated into these new technologies.
One think to take note though is that this being a new tech, version 2 is already being cooked up, so if your project is for the long run, have that in mind and plan accordingly (in my case, being a small project, I'll probably try upgrading my project to version 2 when its officially released). Yet at the same time, having a fully MS (and thus MSDN) supported version 1 was a godsend for me...
Good luck!
I have good experience in Jquery, CSS, HTML, Javascript but not in TDD.
I have time..and willing to learn MVC but wasn't sure MVC is good choice for Job portal or similar site..
This can be considered a shameless self-advertisement but here is my quiz on how to choose between the two:
http://sietch.net/ViewNewsItem.aspx?NewsItemID=101
I was recently tasked by one of my clients to write a paper, or simply a checklist, that would help other lead developers make this same decision.
I posted the first 2 rough drafts on my blog. I am admittedly pro-mvc but the paper/checklist has been we received so it might be helpful.
http://eric.polerecky.com/archives/a-somewhat-less-biases-comparison-of-mvp-and-mvc/[http://eric.polerecky.com/archives/a-somewhat-less-biases-comparison-of-mvp-and-mvc/][1]
I think the most often overlooked benefit of MVC is convention; I really see any convention in webforms projects and while not strictly enforced in MVC projects at least its there.
i started developing our current app in webforms, mvc wasn't available when development started.. i've chosen the MVP pattern, with URL rewrite HTTP module. currently i'm investigating plugging in some MVC into this, basically to use the front-controller instead of using page-controllers. the other things in already established MVP architecture with web forms in my app give me more flexibility than pure MVC approach without WebForms, which i like, although require a bit more code than MS MVC examples (never tried it for real project to see if it stays that way, like in those examples in screencasts).
what i don't like with MVC is mixing control code inside templates - i believe loops, ifs and stuff like that just shouldn't belong inside the template. but a couple days ago i've ran into Spark view engine that looks kind of promising in that segment, although not still close to the Tapestry 5 (a component-based webGUI framework) in the java world.
But the above mention suggestion to mix both might work for you to explore MVC world and have the safe ground to fallback to if something won't work for you might be ok for you.