As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Why does MVC work so well in ASP.NET but not in (.NET) winforms?
There isn't an explicit MVC for winforms offered from Microsoft. However, I see people attempting to use one but they are a bit of a mess compared to ASP.NET MVC.
In my opinion it's due to the fact that there is a one-to-one relationship between the request from the browser and the controller that handles it, as well as the model and subsequent view that renders the model.
With Windows Forms, you don't have such a mapping. You can have multiple things that trigger an event, and you can have multiple views on the model. Because there isn't a request-response pipeline like there is in a HTTP request (one request, one response), you have to handle things like registering multiple views (something you don't have to do in ASP.NET MVC, there is one view, the one that is dictated by the controller), as well as multiple ways of indicating the same input on the controller (again, only one way in ASP.NET MVC, and that's through a request, although this is minor compared to the first point).
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
When it is a users first time visiting a certain part of my web app I want to present a brief modal FAQ to them. We are using .Net MVC on this app, so I know I can accomplish something similar to this using cookies in Javascript with a long expiration date. But, I'm curious if there is a better way to implement this since cookies can be cleared from the browser by the user. I would guess C# or razor would provide me with a more elegant solution. Thanks for any advice!
If the user is authenticated, why not store this information server-side (like in a database)? Then you can communicate the "flag" to the View (via the Model or ViewBag) so it can decide whether or not to prompt with the FAQ.
public ActionResult Index()
{
bool isUsersFirstTime = IsFirstTime(); // Do something to read this value from the database
if (isUsersFirstTime)
{
UpdateFirstTimeFlag(); // Do something to update this value in the database
}
ViewBag.FirstTimeUser = isUsersFirstTime;
}
Then in your view, something like (assuming Razor syntax):
#if (ViewBag.FirstTimeUser)
{
<div>Here's the modal FAQ</div>
}
Obviously, if you're implementing more of an MVVM approach, you'll want to put the FirstTimeUser property in the ViewModel and reference it in the view with Model.FirstTimeUser.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm asked to build a simple web site. Every page of this site is mainly text. I want them to be able to change all the text dynamicly.
What is a better way:
1) To store all the text in database.
2) On text change replace existing aspx file with new one with changed text.
I would prefer a way where the changed pages will load faster on client side
Given these requirements, your best solution is a CMS (content management system).
There are plenty of options for asp.net, like Umbraco, DotNetNuke etc.
Doing this by storing all the text in the database will be just like implementing a CMS. The second option is really really old school. You may as well put static html pages on the server in that case.
You should change text in the controller. Don't replace pages.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Last time I worked on a sizable project with MVC was version 2 and it was a while ago, so I've been out of the loop. Now I am getting started on a small reporting project.
Basically, there will be a half-dozen pre-canned reports and some with criteria to be selected by the user. The users will access the content from computers and iOS/Android devices.
What are some of the libraries that I should include in the project to get me going fast and provide a quality product?
So far I got ELMAH and MiniProfiler.
My list:
Webapi - Create and use an API for your communication with Android/iOS
NHibernate - ORM - if you think your project requires one
Structuremap - Dependency Injection
Automapper - map domain objects to viewmodels
Squishit - I personally love this library for minification but you can also check out the inbuilt mechanisms
I think mvc dose not have change workflow from first version but I have checklist for project
Use T4MVC for Typed Address
for Test I use NUnit
AutoMapper for mapping viewModel
ELMAH for error handeling
Entityframework
MiniProfiler
Bootstrap or jqueryUi
StructureMapper for DI container
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Can anyone give any examples of a single tier architecture that is web-based? I understand that single tier means that all layers are run in the same machine... Would a soap service that returns a number from a database be an example or is that two tiered?
Would a soap service that returns a number from a database be an example or is that two tiered?
Using a database back-end is a two-tier architecture. Another example is the old-school ASP-style of development where the .asp file directly accesses the database.
Can anyone give any examples of a single tier architecture that is web-based?
A single-tier might be a webpage that directly opens a csv file and reads from it. Another example is a web-service that does not require data at all, like a time service.
Actually there is no Single tier web application.
Yes I insist :)
Because the Web Browser and the client machine is actually a tier.
But to make things easy the community assumes to drop this tire due to it's out of developer hands.
Anyway if you consider that any web page which is not dealing with database OR in better way like csharptest.net said :
A single-tier might be a webpage that directly opens a csv file and reads from it. Another example is a web-service that does not require data at all, like a time service
You may consider that as Single tier
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I intend to build application with Winform and I would like to use MVP pattern.
Since I have never used MVP pattern before, I am not sure how to structure the new project.
Should I use same convention as in ASP.NET MVC like creating in the project separate folders for Models,Presenters and Views, then maybe using naming convention for Presenter classes so that their name ends with word "Presenter" (the same way the names of controllers in MVC end with "Controller")
Or should I create separate projects for Presenter and Model?
Honestly, this is a very subjective question. The way I am doing this today may not be the way I do this for the next application. It simply works out well for me. Also, what works for me may not be the way anyone else would do it - not that mine is wrong, better, or worse.
Naming conventions will help:
PersonPresenter
PersonViewModel (if data is read/write to data store)
PersonView
IPersonView
Also, I have separated my current solution into 3 projects:
The app itself - the only class in that project is Program.cs
Presentation Models: presenter, view interface, view model (if applicable); all in folders organized by their respective views
Views: a project just for the views
Now, the only piece of the solution that I need to reference for unit testing is the PresentationModels project.