Category: tips and tricks
-
5 Minutes .NET–Memory Cache
At https://youtu.be/BL5yo_p7x-E you can find the new video about caching in .NET with Memory Cache. The code is: and using from Console: Other tutorials are: 5MinThrowVsThrowEx 5Min Usefull Attributes 5MinIValidatableObject 5MinAsyncException 5MinAsync 5Min iMacrosAHK 5min Zip 5MinPSR 5MinParseWebPage 5MinFileHelpers 5Min Logging 5min Send emails and SMTP4Dev 5Min Memory Profiler ( User Object…
-
Javascript MVVM and ASP.NET MVC
TL;DR; The purpose of this article is to show is how to transmit data to edit( create,update,delete) from a MVVM array to an ASP.NET MVC action in order for the action to bind to an IEnumerable/Array/List of objects. We will make also a javascript function that can be re-use across multiple MVVM frameworks to transmit…
-
MVC,JsonResult,DateTime and TimeZone
The jsonresult of date time is serializing to the string /Date and some integer value starting with 1970 . The problem is that the browser interprets this value accordingly to the LOCAL TimeZone – and thus the same date is going to be interpreted with a difference. I was thinking that I can adjust from…
-
MVC and auto persisting values
When you have a textbox in HTML (let’s say <input name=”FirstName” type=”text” /> ) And it binds to “FirstName” Property of a Model,and in HttpPost Action you do modify the value and return the same view,the value shown in the textbox is the posted one,not the modified one. ( The first thought is that HttpPost…
-
Redirect and Ajax Redirect in MVC
In the sample example I will have various methods to perform redirects from main page to “About” page of a simple MVC site. In my opinion,there are only 3 cases – 2 goods and one bad – to perform redirection with or without Ajax. First case: A sample redirect and a sample link: The…
-
Optimizing EF4 and EDMGen2
Just reading (from Adrian Florea links ) how the EF4 could be optimized : http://www.codeproject.com/KB/database/PerfEntityFramework.aspx First modification is to “Pre-generated Your View”. For this you must have .ssdl,.csdl,and .msl files – so you change the “Metadata Artifact Processing property to: Copy to Output Directory.”. Then you process the .ssdl,.csdl,and .msl with edmgen in order to…
-
Five common mistakes for ASP.NET (MVC) accesing resources : css,js,images,ajax
To have once for all the link to show to people,because too much makes the same error again and again. (From here – you can use ResolveUrl or Url.Content – it’s the same for me. I use ResolveUrl because I used first …) Case 1 The image does not display Please check you have the…
-
Generating history trigger with EF,edmx and TT files
I have wrote in an older post ( http://msprogrammer.serviciipeweb.ro/2010/06/28/ef-automatic-history-of-table-and-t4-files-tt-files/ ) how to generate history code for tables . The easy solution was to create a tt file that track for the ObjectContext the SaveChanges for each table that has a “history” in name. the limitation is that,when you raise an sql command such as “update…
-
First Install of tools for programmer
My primary tools are Visual Studio ( and the Express suite),Sql Server ( and SQL Server Management Studio )( and the Express suite) and Office (Excel,Word) Those are the modification that I do every time … I wish there were enabled by default : For VS2010 Go to=> Tools,Options,Html,Formatting,Check “ Insert attribute value quotes when…
-
ASP.NET MVC Extensions Methods
These are my extensions. Not display dropdownlist if the Select list is null Transform Enum to SelectList Transform Generic list into a SelectList Display pager control Other extensions available that are good : http://blog.wekeroad.com/blog/asp-net-mvc-list-helper-extension-method/ http://www.hanselman.com/blog/ASPNETMVCSessionAtMix08TDDAndMvcMockHelpers.aspx http://helios.ca/2009/09/21/asp-net-mvc-extension-methods-of-urlhelper/ http://blog.donnfelker.com/2010/02/25/asp-net-mvc-tempdata-extension-methods/ http://inq.me/post/ASPNet-MVC-Extension-method-to-create-a-Security-Aware-HtmlActionLink.aspx If you know more,please tell me