Articles : Page 1 of 2

  • Massive and Complexity

    Massive and Complexity

    Aug 11
    09

    Got an email today from someone watching the MVC 3 series and they asked the question (paraphrasing): “I like what you’re doing with Massive - but can it handle complex queries?”. This, fortunately, is where Massive shines. In response I wrote this: “Absolutely. In fact it’s why I wrote it. Here’s a semi-complex query that is all too common in the business case: var results - DynamicModel.Open(connectionString).Query(@" SELECT Orders.OrderNumber, Categories.Name FROM Products INNER JOIN...


  • Silverlight, WPF, Wp7, ASP.NET, SharePoint Articles in July 2011

    Silverlight, WPF, Wp7, ASP.NET, SharePoint Articles in July 2011

    Jul 11
    31

    This post showcases some articles that were published on www.dotnetcurry.com in July on ASP.NET, ASP.NET MVC 3, SharePoint, Silverlight, WPF, Visual Studio, WCF, LINQ and other .NET technologies. ...

    • LINQ
    • MVC3
    • Di

  • Referencing Routes in ASP.NET MVC The Rails Way

    Referencing Routes in ASP.NET MVC The Rails Way

    May 11
    30

    Routing is probably the most confusing aspect of working with ASP.NET MVC. It’s hard to craft a groovy URL - even harder to link properly off to that groovy URL. Rails leans on Ruby’s forgiving and friendly nature to make this a bit more simple - C#4 allows to get close to this as well. With Rails 3  you define a route in your config/routes.rb like this: match "order/receipt/:id" => "orders#receipt", :as => :receipt # receipt_url You can access this route anywhere in your application ...


  • Conditional Filters in ASP.NET MVC 3

    Conditional Filters in ASP.NET MVC 3

    Apr 11
    25

    Say you want to apply an action filter to very action except one. How would you go about it? For example, suppose you want to apply an authorization filter to every action except the action that lets the user login. Seems like a pretty good idea, right? Currently, it takes a bit of work to do this. If you add a filter to the GlobalFilters.Filters collection, it applies to every action, which in the previous scenario would mean you already need to be authorized to login. Now that is security ...


  • Using EntityFramework with ASP.NET MVC 3

    Using EntityFramework with ASP.NET MVC 3

    Mar 11
    21

    A few people have asked about a comment I made on my last post: I might suggest (in this case) creating an ActionFilter and wrapping the Action in a transaction. It’s transparent, it’s fun… and all the kids are doing it. … and it got me thinking. All of the MSDN samples that I’ve seen which talk about using EF or LinqToSql with ASP.NET MVC almost always show the context being created inside an action or being passed in via a repository. This doesn’t have to be the case - in fact it probably...


  • Using EntityFramework with ASP.NET MVC 3

    Using EntityFramework with ASP.NET MVC 3

    Mar 11
    21

    A few people have asked about a comment I made on my last post: I might suggest (in this case) creating an ActionFilter and wrapping the Action in a transaction. It’s transparent, it’s fun… and all the kids are doing it. … and it got me thinking. All of the MSDN samples that I’ve seen which talk about using EF or LinqToSql with ASP.NET MVC almost always show the context being created inside an action or being passed in via a repository. This doesn’t have to be the case - in fact it probabl...


  • MVC 3 AdditionalMetadata Attribute with ViewBag to Render Dynamic UI

    MVC 3 AdditionalMetadata Attribute with ViewBag to Render Dynamic UI

    Jan 11
    31

    A few months ago I blogged about using Model metadata to render a dynamic UI in MVC 2. The scenario in the post was that we might have a view model where the questions are conditionally displayed and therefore a dynamic UI is needed. To recap the previous post, the solution was to use a custom attribute called [QuestionId] in conjunction with an “ApplicableQuestions” collection to identify whether each question should be displayed. This allowed me to have a view model that looked like this: ...


  • Hosting the Razor Engine for Templating in Non-Web Applications

    Hosting the Razor Engine for Templating in Non-Web Applications

    Dec 10
    28

    Microsoft’s new Razor HTML Rendering Engine that is currently shipping with ASP.NET MVC previews can be used outside of ASP.NET. Razor is an alternative view engine that can be used instead of the ASP.NET Page engine that currently works with ASP.NET WebForms and MVC. It provides a simpler and more readable markup syntax and is much more light weight in terms of functionality than the full blown WebForms Page engine, focusing only on features that are more along the lines of a pure view engine...


  • Class-Level Model Validation with EF Code First and ASP.NET MVC 3

    Class-Level Model Validation with EF Code First and ASP.NET MVC 3

    Dec 10
    10

    Earlier this week the data team released the CTP5 build of the new Entity Framework Code-First library. In my blog post a few days ago I talked about a few of the improvements introduced with the new CTP5 build. Automatic support for enforcing DataAnnotation validation attributes on models was one of the improvements I discussed. It provides a pretty easy way to enable property-level validation logic within your model layer. You can apply validation attributes like [Required], [Range], a...


  • Announcing Entity Framework Code-First (CTP5 release)

    Announcing Entity Framework Code-First (CTP5 release)

    Dec 10
    08

    This week the data team released the CTP5 build of the new Entity Framework Code-First library. EF Code-First enables a pretty sweet code-centric development workflow for working with data. It enables you to: Develop without ever having to open a designer or define an XML mapping file Define model objects by simply writing “plain old classes” with no base classes required Use a “convention over configuration” approach that enables database persistence without explicitly configuring anyt...