New answers tagged

-1

One of the benefits of using Visual Studio for Asp.NET MVC is the seperation. When I develop something using CakePHP, it feels like everything gets jumbled into a few single files and the code will get clunky. If you are still going down the road of MVC (which I highly recommend), you might want to check out DJango or even Asp.NET MVC with the community ...


1

With a little guidance from @RobertHarvey I found a StackOverflow answer about Presentation Models. A presentation model is a utility class that is used to render data on a screen or report. Presentation models are typically used to model complex data structures that are composed from data from multiple DTO’s. Presentation models often represent a ...


2

Your understanding is correct. Keep in mind that different frameworks use different approaches, so something which would for instance apply to Laravel won't necessarily apply to, say, Symfony. This is especially true when it comes to deciding where the logic goes: some frameworks use models as basic objects containing data, but practically no logic by ...


0

So my problem is, I have users entering their data(names, address) in a mixed form- some with first letter in caps and some without, some inserting more than necessary spaces and so forth. To reduce this "noise", redesign your UI to capture this data in a more "structured" form, i.e. separate fields for Title, Forename(s) , Surname. However, bear these ...


0

I would be cautious about simplifying what goes on under the hood of Angular.js to MVC, as there have been countless discussions about what MVC even is, and whether Angular implements MVC or MVVM or some other MV* paradigm. It's kind of become accepted in the Angular world that they implement Model-View-Whatever and leave it at that. Having said that, the ...


0

From the documentation, I am assuming that by "most templating systems", they are referring primarily to server-side templates which get rendered into a view. I feel comfortable making this assumption due to a later statement explaining why angular is different: "... the template ... is compiled on the browser. The compilation step produces a live view." And ...


1

I was able to download the nuget package file and install the package as per http://stackoverflow.com/questions/10240029/how-to-install-a-nuget-package-nupkg-file-locally Then, to setup the jQuery UI properly in Visual Studio 2015, I followed this article: http://www.codeguru.com/csharp/.net/net_asp/a-jquery-ui-based-date-picker-for-asp.net-mvc-5.html ...


0

<?php $t = Lang::get('myLangFile') ?> <div><?= $t->helloWorld ?></div> This works and guarantees me my views will work regardless of who's calling them and basically costs nearly nothing in terms of performance because instantiating a Translations will not copy the array containing the information unless a change is ...


4

Model View Controller is one of the oldest if not first design pattern. It was created at a time when few people understood any proper way for objects to interact. Consequently the only common thing implementations have is three separate areas of responsibility: Model, View, and Controller. How they interact and which knows about what is completely up for ...


3

One way to achieve what you're asking with minimal code changes is to check in both the view and the model if data has actually changed when a notification comes in before performing an update/notify. Program-flow example: User sets text field to "Some text". GUI sends an update notification to the model with the new value. Model checks that the value has ...


1

Design patterns don't have much to do with with languages you use. They attempt to separate an application to different elements in an effort to facilitate loose coupling and portability to different platforms to mention a couple. I don't see why using MVC wouldn't be feasible in game development. The nature of the application very rarely defines the ...


0

Because Item objects have one field that is in another collection in the model. If one changes the other must update, so that's why I need to know That's the observer pattern. I'm not sure if you're dealing with a 1 to 1 or a 1 to many since you've indicated that there are two collections but the observer pattern is basically one thing keeping a ...


1

The decision of whether something has been modified or not is best left to a collection of objects that can perform change-tracking or dirty-checking. Your view model is not the best place for this. Having a collection of classes called your "Domain Model" containing business logic and utilizing an Object Relational Mapper (ORM) can do the dirty checking of ...


0

Basically what you did wrong was to copy/paste code. DO NOT copy code. Instead, if you want to reuse code Move the code in a function (this is what functions were invented for). Call the function. There are different opinions on where to put the function (model, service layer, controller, base controller) but that is the icing on the cake - you can ...


1

...can you please tell me if I'm doing it right or wrong? Unfortunately, most here would probably disagree that this the right way to structure things. There is a number of issues that I can see: You have no layering to the application, your controller populates the view with result that it, itself, pulls out of the database. Split the logic into layers,...


1

first of all you can move your db context to a separate class and preferably project as well. this class would be your data layer, it should have all the queries in it. You would call them as functions like this (which sould be better named to say what they are getting) model.A = getStrQueryData(EmpId) model.X = getRtsQueryData(EmpId) model.C = ...


-1

The router takes the request and decides which controller/controller methods will handle the request. The controller accepts the requests and handles it! Now I've also made controller that splits the url and uses the first part after the base url as controller and second part as action. This loads a file corresponding with the controller and a ...


1

Does your DBMS care about which naming convention you use? No Do you care? You probably do, just like any other human would. Everyone has a preference. Do your colleagues care? Yes? Consult with them. Does your ORM care? You should be able to answer this one yourself. I'm not familiar with Dapper but I have experience with Entity Framework, ...



Top 50 recent answers are included