As you build out a site using the code first approach, at some point you will most likely need to add an additional lookup field to a class. There are a couple of steps required above what’s automatically done for you by EF code first migrations to make things work happily. If you consider the … Read more
An application I’m working on requires a facebook style status system and I thought it would be good to include the “posted x minutes ago” text after the status. I’m sure my code is not the most elegant solution but it works so I thought I’d share.
If you’re using LINQ to SQL as your data provider then you will need to add a few extra steps to utilise Data annotations with ASP.NET MVC. If you have created your own objects then you can append annotations such as [DisplayName(“This is the display name I want in the view”)] directly to the object … Read more
I needed to get a number of random records from a table. This is a very quick and easy mechanism to use and will work on any table. To load a specific number of random records change the .First() function to be .Take(x) replacing x with however many records you need.
The function returns a paragraph tag with a link for each tag. Each link has a specific class attribute set depending on the weighting given to that tag. The C# code: The CSS: