background preloader

NuGet Gallery

NuGet Gallery

ASP.NET MVC Partial Views and Strongly Typed Custom ViewModels I'm in the process of rewriting mikesdotnetting.com using the ASP.NET MVC framework. It's an interesting experience, in that this is my first exposure to MVC. The first stumbling block I encountered was how to pass data in a satisfactory way to Partial Views which only represent part of the data that is to be displayed in the View. Since I struggled to find clear guidance on this, I thought I would share a way to do it. There are a fair number of articles and blog pieces about the difference between ViewDataDictionery and ViewDataDictionery<TModel>, but there's no harm in taking the opportunity to recap - especially as the MSDN documentation is (at the moment) pretty thin on notes in the MVC Reference section. The first type of ViewDataDictionery is an untyped collection consisting of a string and an object. I am using the Entity Framework to generate the business objects and manage Data Access within the application. I don't want to use this class for the listing of Article Titles.

How to create lightweight reusable source code with NuGet Sometimes, you just have a reusable helper that you bring in to every project (i.e. an argument validation thingy, or the static reflection stuff, useful extension methods, and so on). You don’t always need them all, they are generally single-file utilities, and having a Common.dll looks overkill or dumb. Loose source file sharing has always been problematic, though: no packaging and versioning mechanism (unlike an assembly), hard to integrate with source control systems (SVN has external repository mappings, but nothing like that exists in TFS or Mercurial, AFAIK), and so on. I tried source files reuse before, with somewhat poor results. In a recent project I wanted to reuse (again) that darn useful Guard.cs file. Two key technologies enable some pretty cool and robust source file reuse nowadays: NuGet: unless you’ve been living under a rock, you probably heard all the bignamestalking about it. So let’s get started and create the Guard package Creating the reusable source file And typing:

Inside F# Installing NuGet Visual Studio 2010, 2012 and 2013 For Visual Studio 2010, NuGet is available through the Visual Studio Extension Manager. The extension can be installed into the Professional, Premium, and Ultimate editions. Additionally, the extension can be installed into Visual Web Developer 2010 Express Starting with Visual Studio 2012, NuGet is included in every edition (except Team Foundation Server) by default. To check if your copy of Visual Studio already has the NuGet extension, look for Library Package Manager in the Tools menu of Visual Studio. To download the extension for Visual Studio 2010 and 2012 directly, it can be found on the Visual Studio Extension Gallery and for Visual Studio 2013 directly, it can be found here on the Visual Studio Extension Gallery. Command-Line Utility A command-line NuGet utility is also available. The latest version of the nuget.exe command-line tool is always available from our dist share. In Visual Studio, click Tools and then Extension Manager.

How to: Deploy an ASP.NET MVC Application If your hosting provider already has ASP.NET MVC 1.0 installed on the hosting server, deploying your MVC application is no different that deploying any ASP.NET Web application. However, if the hosting provider does not currently support ASP.NET MVC 1.0, you must upload the required MVC assemblies in the Bin folder of your deployed application. After ASP.NET MVC is installed, the following assemblies are located in the global assembly cache (GAC) on your computer: System.Web.Mvc (the ASP.NET MVC assembly) System.Web.Routing (a .NET Framework assembly that is required by ASP.NET MVC) System.Web.Abstractions (a .NET Framework assembly that is required by ASP.NET MVC) If your hosting provider has ASP.NET version 3.5 Server Pack 1 installed, you have to upload only the System.Web.Mvc assembly. ASP.NET MVC runs in medium trust. To deploy an ASP.NET MVC application In Visual Studio, open the project that you want to deploy.

NuGet Symbol and Operator Reference (F#) This topic includes a table of symbols and operators that are used in the F# language. The following table describes symbols used in the F# language, provides links to topics that provide more information, and provides a brief description of some of the uses of the symbol. Symbols are ordered according to the ASCII character set ordering. The following table shows the order of precedence of operators and other expression keywords in the F# language, in order from lowest precedence to the highest precedence. Also listed is the associativity, if applicable. F# supports custom operator overloading. Reference Other Resources

Packages Json.NET 109,463,698 total downloads last updated a month ago Latest version: 11.0.1 json Json.NET is a popular high-performance JSON framework for .NET 18,787,141 total downloads last updated 6 days ago Latest version: 3.10.1 nunit test testing tdd framework fluent assert theory plugin addin NUnit features a fluent assert syntax, parameterized, generic and theory tests and is user-extensible. This package includes the NUnit 3 framework assembly, which is referenced by your tests. Bootstrap CSS 15,946,860 total downloads last updated 2 months ago Latest version: 4.0.0 css mobile-first responsive front-end framework web The most popular front-end framework for developing responsive, mobile first projects on the web. 45,689,927 total downloads last updated 2 months ago Latest version: 3.3.1 jQuery 6,770,027 total downloads last updated 15 days ago Latest version: 1.7.1 HTML parse crawler spider linq Microsoft ASP.NET MVC Selenium WebDriver Apache log4net

Sorting, Filtering, and Paging with the Entity Framework in an ASP.NET MVC Application (3 of 10) The Contoso University sample web application demonstrates how to create ASP.NET MVC 5 applications using the Entity Framework 6 Code First and Visual Studio 2013. For information about the tutorial series, see the first tutorial in the series. In the previous tutorial you implemented a set of web pages for basic CRUD operations for Student entities. The following illustration shows what the page will look like when you're done. Add Column Sort Links to the Students Index Page To add sorting to the Student Index page, you'll change the Index method of the Student controller and add code to the Student Index view. Add Sorting Functionality to the Index Method In Controllers\StudentController.cs, replace the Index method with the following code: This code receives a sortOrder parameter from the query string in the URL. The first time the Index page is requested, there's no query string. ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? These are ternary statements. Build the project.

A Sample of the Memoization Pattern in F# - Don Syme's WebLog on F# and Related Topics - Site Home - MSDN Blogs Pieter Breed has been asking some useful questions on the F# list recently about using the "Map" type. I really appreciate it when people take the time to let us know when data structures are tricky to learn to use in F#. Looking at Pieter's blog made me think it might be instructive to show how the memoization pattern looks in F# (or at least one example of the pattern). #light open System open System.Text open System.Collections.Generic // Save computed results by using an internal dictionary.// Note that memoize is inferred to have type// memoize: ('a -> 'b) -> ('a -> 'b) let memoize f = let cache = Dictionary<_, _>() fun x -> if cache.ContainsKey(x) then cache. else let res = f x cache. res // An example, taken from Pieter's blog let memoizedAppend = memoize (fun input -> printfn "Working out the value for '%A'" input String.concat ", " [ for i in 0 .. 9 -> sprintf "%d: %s" i input ]) And using this in F# Interactive: Some things to note here: Update: Here's the single-lookup version of this: match (!

NuGet Docs Filtering a Grid of Data in ASP.NET MVC By Scott Mitchell Introduction This article is the fourth installment in an ongoing series on displaying a grid of data in an ASP.NET MVC application. The previous two articles in this series - Sorting a Grid of Data in ASP.NET MVC and Displaying a Paged Grid of Data in ASP.NET MVC - showed how to sort and page data in a grid. In particular, the demo we examine in this installment presents an interface with three filtering criteria: the category, minimum price, and whether to omit discontinued products. Like with its predecessors, this article offers step-by-step instructions and includes a complete, working demo available for download at the end of the article. Step 0: A Brief Roadmap This article walks through displaying a filtering interface and then showing only those matching records in a grid of data. Recall that in Sorting a Grid of Data in ASP.NET MVC the demo was available at the URL www.yoursite.com/Products/Sortable. categoryId - an integer value. Step 3: Creating the View

Related: