Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Monday, December 17, 2012

Converting Enum to List in C#

This is an easy but recurrent question that I end searching on Google from time to time. So to adhere to this blog's motto and not searching it again here's the solution:

Enum.GetValues(typeof(SomeEnum)).Cast();

(The original solution thread at stackoverflow)

Monday, November 19, 2012

HOW TO: query many-to-many relations in EF 4


While working with Entity Framework I found my self a bit lost while working with many-to-many relations, as I expect that a class should exist to represent the many-to-many relation table, but in fact, it doesn't exist. So how on earth do you make a query that intends to use the many-to-many relation?...

The answer come from the usual suspect, her's the link at StackOverflow:

http://stackoverflow.com/questions/553918/entity-framework-and-many-to-many-queries-unusable

Thursday, September 20, 2012

So .NET MVC is Open Source? ... yes, it is!

Recently I had a doubt about the insides of a .NET MVC method, so I posted a question on SO. To my surprise, one of the answers told me to take a look at the source code by myself... and then I met The Source Code:

http://aspnetwebstack.codeplex.com/SourceControl/list/changesets

A highly recommended resource for every MVC programmer out there.

Tuesday, April 24, 2012

HOW TO: Map an entity property to a CLOB field (nHibernate / Fluent)

I'm working on a project that uses nHibernate with Fluent. Today I needed to map an entity property to an Oracle CLOB field. So, after a little of googling, I find that the solution is just to set the CustomSqlType property of the entity to "CLOB" in the mapping class, or if you prefer (as in my case) in a Convention.

The link to the solution in Stackoverflow.