Tag Info

New answers tagged

1

I also prefer strongly-typed views with dedicated ViewModels. To get around the problem you are seeing I sometimes construct my ViewModels like: public class UserCarsViewModel { public User User { get; set; } public List<Car> Cars { get; set; } public bool SomeCalculationIDontWantToHaveToDoInRazor { get { return _some mildly ...


0

I am getting HTML and JavaScript autocompletion for *.cshtml files in WebStorm like this: All I did was to register '*.cshtml' as html files under Settings | Editor | File Types See: https://www.jetbrains.com/webstorm/help/file-types.html


0

I would probably do this a third way, which is by adding a column to your rating table whose value is the average rating after that rating is applied. This means that this stage of the calculation will only need to be preformed once rather than every time your stored procedure is executed, resulting in somewhat better performance. Technically this results in ...


2

You are right, DAL reference should NOT exist in the UI project. You should instead create DTO objects for sending/recieving data to your BLL. It can be a separate project called DTOs or can be included in the BLL by creating specific folders like Customer and placing its facade classes along with the DTOs in that folder. BLL will be responsible for mapping ...


0

There is no definite answer. Personally I'm strongly against internationalizing when you don't need it. I have done tons of corporate web sites and I can say for sure that doing internationalization consumes more time than you imagine at first. Event when using more advanced and less tedious methods than resource file provides. Keep in mind, that you can ...


0

Use a caching mechanism that is independent of the stateless queries run by the user. Much in the same way database connections are pooled - ie you never open a new DB connection apart from the first time, every subsequent 'open' really fetches a previously used connection from a cache inside the DB client driver. You need to determine a method for handling ...


0

In general, holding a file open between user requests is not a good idea. There are several problems: The session can time out, leaving the file in limbo. In a busy system, this can lead to file handles running out. Many "enterprise" quality web containers serialize your session to a database when they are busy. You don't say what language you are using, ...


3

You could use Sessions here but that has a few downsides. The oft-quoted one is the default configuration (in process) is fast but the session dies if the app pool gets restarted. Code-wise this means you typically need to check if your session has not died so you can handle it gracefully. This is fairly easy to do but it is some overhead. The bigger ...


0

The last MVC app I designed I had to hold onto a file through multiple pages before it was 'saved' (as at any point the user could cancel). I stuck it in Session and all has worked well since. That said, this feature doesn't get much use (10s of users at once) so I do not have data on how it scales. While the web is stateless and MVC design lends itself ...


1

The nice thing about YAGNI is that it can be quantified. There are three metrics too look at: The time saved by applying YAGNI and not implementing something up-front. The probability that the application will have to be rewritten The time needed for rewriting the application a couple of years in the future. When time saved > time needed for rewriting ...


0

For our production websites we install OctoPack (Octopus Deploy) into the web solution via a nuget package in Visual Studio 2013. We set up a Team City build configuration for that project to trigger a deployment with Octopus Deploy, in which we have set up a project and several machines and environments (e.g. staging, live). We use config transforms to ...


0

I generally don't expose my poco objects to the UI layer. Create a wrapper/domain objects layer that will transform the data of Dal layer. This way you can control the data going to the UI layer.


0

While a lot of the answers here are great, I think the answer is MUCH simpler: you're looking at the wrong technology for the job. If you're looking to build a SOAP-service, you really should stick to WCF. It's still a very powerful framework, Microsoft is still actively developing it, no announcements were made for us to think it's going anywhere in the ...


1

I am a fan of using data attributes: HTML: <div class="ajax-widget" data-endpoint="/api/some-endpoint"> ... </div> JS: // Or whatever your initialisation logic is. $('.ajax-widget').each(function() { // Grab the endpoint and use it for something. // e.g. AJAX call, assigning to a property for later etc. var endpoint = ...


0

In that case I would do something like this (pardon my Razor syntax): HTML Link code: @Html.ActionLink("Link Text","ActionMethod","MyController", new { someArgument }, new{ id="mylink"}) Javascript code: $("#mylink").click(function(e){ e.preventDefault(); $.ajax({url:'@Url.Action("ActionMethod","MyController",new{ someArgument })'}); }); ...


1

What you want to do is start with a config object: myApp.config = { myUrls: { someUrl: "http://default.com"; }, someSharedPropAcrossAllEnvs: 'something' }; And then create environment specific versions that override the appropriate values: var envs = {}; var envs.dev = { myUrls: { someUrl: "http://localhost:8080"; } }; var envs.test = ...



Top 50 recent answers are included