Dec 30 2011

Simple ASP.NET MVC script manager

Category: ASP.NET | C# | MVC3 — Duke @ 15:57

I remember that some months ago I’ve found a beauty video of a beauty component that allows to manage .js and .css files from an MVC application.

Unfortunately I’ve lost the link and I don’t remember the name of the component.

I’ve searched the seven seas of the internet but… nothing. Things went worst today when I realized I need a script manager.

I’ve searched, browsed and digged the internet again but the best I’ve found is the “Simple script manager” on codeplex, that is well far from being “beauty”

So, I’ve started my own simple script manager. for now it is very basic. it does almost nothing but at least it is in full “MVC” style, by using and respecting the existing design of MVC3, differently from the other things I’ve found.

 

so: here is the code More...

Tags: , ,

Oct 30 2011

Asp.net MVC3: entity framework 4.1 UniqueValue attribute validator

Category: ASP.NET | C# | Linq | MVC3 — Duke @ 15:28

I’m playing with MVC3 and EF4.1 (magic unicorn version) for a nice project I’m working on, and I’ve found myself in the situation to validate some fields against value duplication

(think about username, or other things that must be unique).

Unfortunately we don't have [Unique] constraint attribute in EF4.1 yet, so I’ve thought to leverage on the validation infrastructure of MVC3 to ensure uniqueness of the values.

I like the simplicity and expressiveness of the attributes then I’ve implemented my UniqueValueAttribute class.

this is remarkable because now I have a simple way to decorate every model attribute I want to be unique

(lot of fun code follows) More...

Tags: