Tag Info

Hot answers tagged

97

I developed ASP .Net WebForms applications for 3 years, and after one day of doing an MVC tutorial I was sold. MVC is almost ALWAYS the better solution. Why? The page lifecylce is simpler and more efficient There is no such thing as controls besides html controls. You don't need to debug your output to see ASP .Net is generating. ViewModels give you ...


62

Webforms vs. MVC seems to be a hot topic right now. Everyone I know touts MVC to be the next great thing. From my slight dabblings in it, it seems ok, but no I don't think it will be the end of webforms. My reasoning, and the reasoning as to why webforms would be chosen over MVC, has more to do with a business perspective rather than what one is better ...


55

I emailed Scott Guthrie, an MVC expert at Microsoft. And probably the most qualified man to answer this question. He was kind enough to reply: "Different customers look for different programming approaches, and a lot love WebForms and think it is great. Others love MVC and think it is great. That is why we are investing in both. " So, to me ...


50

The single best reason to not use the repository pattern with Entity Framework? Entity Framework already implements a repository pattern. DbContext is your UoW (Unit of Work) and each DbSet is the repository. Implementing another layer on top of this is not only redundant, but makes maintenance harder. People follow patterns without realizing the purpose of ...


34

I recently switched from using in-line SQL queries to using EF and here's what I've found: Pros Much faster to build the DAL (love not writing the SQL queries!) Much easier to maintain No longer need to remember to parse my input before building an in-line sql statement, which means less chance of a SQL injection attack (of course, it's still possible ...


31

I don't see any reason for Repository pattern to NOT work with Entity Framework. Repository pattern is an abstraction layer you put on your data access layer. Your data access layer can be anything from pure ADO.NET stored procedures to Entity Framework or an XML file. In large systems, where you have data coming from different sources (database/ XML /Web ...


30

Generally, you want your Controllers to do only a few things: Handle the incoming request Delegate the processing to some business object Pass the result of the business processing to the appropriate view for rendering There shouldn't be any data access or complex business logic in the controller. [In the simplest of apps, you can probably get away ...


28

I am a complete and total convert to ASP.NET MVC and have not looked back, that said I do still have to maintain several very large WebForms apps. Here's my take on it: WebForms Use these when you have some serious heavy lifting to do with grids. The grid controls are really very nice when you have a simple dataset that fits nicely in a tabular format and ...


24

Actually there is a push back in the .NET world against these very things you mentioned. In the first example you gave however, the routing engine is given a convention for mapping the default route. The very fact that the routes are dynamic make it nigh impossible to use a static configuration. You also mention XAML/WPF, both of which were under ...


23

I have developed real applications with both Rails and ASP.NET MVC, but this answer comes with a significant caveat: I learned and developed with pre-version 2 Rails, so it is entirely possible that I am vastly out-of-date with my Rails knowledge. That being said, I don't think that there is anything that can be done with one but not the other. Given any ...


23

This answer is going to get downvoted into oblivion but, on the whole I see WebForms as being for cargo-cult programmers, while MVC is the technology of choice for more seasoned developers who understand the importance of simplicity & maintainability.


20

You should try to meet two goals: Uniqueness, and usefulness. Using a GUID guarantees uniqueness, but one day the files may become detached from their original source, and then you will be in trouble. My typical solution is to embed crucial information into the filename, such as the userID (if it belongs to a user) or the date and time uploaded (if this is ...


19

Here's one take from Ayende Rahien: Architecting in the pit of doom: The evils of the repository abstraction layer I'm not sure yet whether I agree with his conclusion. It's a catch-22 - on the one hand, if I wrap my EF Context in type-specific repositories with query-specific data retrieval methods, I am actually able to unit test my code (sort of), which ...


18

I'll share the way I ended up doing this, that was part of the original question. First, the problems I encountered: With customErrors on (i.e. in production) the global HandleError attribute swallows exceptions and renders your error view, but then you can't log it with an addon tool like elmah, since elmah never sees it. You could log it in your view I ...


18

Stateless means that HTTP doesn't have built in support for states. i.e. you can't store if a user have logged in or done something else. The most common solution is to use sessions to overcome that problem. This means that you have to be able to include a session identifier in each response or request. It's either done by creating a session cookie or by ...


18

I HAVE successfully used XSLT as a web presentation tier... in 1999. In the last 12 years, much better options have come along. Do yourself a big favor, and use Razor. It's a pleasure.


18

private void Demo() { // Do something, given that the result doesn't matter. } public void Do() { Task.Factory.StartNew(this.Demo); // The following line will be executed without waiting for the result. DoSomethingElse(); } Note that starting a method without caring about the result or about exceptions it can throw is risky. If an ...


17

Here is a basic syntax comparison Razor @foreach(var item in View.List) { <span>@item.Name</span><br/> } XSLT <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="item"> <xsl:for-each select="name"> <xsl:value-of ...


17

Process that people should be doing on a job as a new hire Initially look at the code Small bug fixes Bigger bug fixes Feature Requests - Adding something to an existing piece of the puzzle New things - Creating something from nothing Rushing a green developer with no domain experience too far too fast will cause way too many problems. You're going to ...


16

It could have been done in a variety of languages and frameworks. As I recall SO and its sites are done in MVC not just vanilla ASP.Net. I'm sure it's as much an extension of the collective developers' combined expertise as much as it is a technology choice. If you really got down to it, this site could have been done using raw html, javascript and lisp as ...


16

This sounds suspiciously like an inner platform. Here are the potential problems: You'll be writing queries that query the database for what information to query (metaqueries) first, rather than queries that simply retrieve the needed information. You'll be subverting the role of the database, which already provides metadata capabilities such as rows, ...


16

Presentation logic comprises the logic and calculations that are needed to present the business data in the right way for a particular view. For complex graphical views, this can be quite complex calculations (for example, calculating the size of each pie slice and the positioning of the labels for a pie chart), but the main characteristic is that it only ...


15

To illustrate the concept of state I'll define a function which is stateful and one which is stateless Stateless //The state is derived by what is passed into the function function int addOne(int number) { return number + 1; } Stateful //The state is maintained by the function private int _number = 0; //initially zero function int addOne() { ...


14

My experience: Wrote CakePHP projects for one year. Completed a medium sized Webforms project over six months. Worked on a Windows Forms project for three years. After that experience, I tried writing another app using webforms, and got frustrated after struggling for about a day with how webforms attempts to shield the developer from the reality that ...


14

ASP.NET as a web technology and is not tied to any specific database. As such, you can use NHibernate or standard data access methods to connect to MySQL on the backend.


14

First things first. You're the newbie. You'll get the crap assignments. There is no way around that. You must understand that this is not malicious. Like you yourself have stated, these guys have more experience and are more skilled. They are also probably on a higher pay grade as well. Which means, from the project's point of view, their time is precious ...


13

Most successful open source projects became successful because first and foremost, the program was impressive or did something no other program could do at the time. That doesn't necessarily mean the source is well-documented, since the programmers which began the project to begin with know the code well enough to not need it. It's an unfortunate reality ...


13

Displaying the key is totally optional, but it isn't a security issue even if you do. You need to check if the user has access, always. That is your job, not the framework's. But you don't have to use a numeric id. I like to do something like the content type and title in the url: /news/title-of-article /reservations/description-of-hotel-and-reservation ...


12

POCO stands for plain old c# objects. It comes from the java equivalent POJO. It's just a hip name to show the world that not everything has to be a derived class. POCOs are not necessarily DTOs, they can be full blown objects with behavior and state and clild POCOs, while DTOs only have state. Now about your domain - if as you say you are trying to do ...


12

Is there maybe a more stripped down starting point I should use if the VS template is adding a lot of stuff I don't need? These VS templates are good to trim down initial setup and learning curve in the beginning, however you would need to customize them for your real project needs. For example, on this site http://www.reviewstoshare.com, my friend ...



Only top voted, non community-wiki answers of a minimum length are eligible