Skip to content

Instantly share code, notes, and snippets.

View wilsonat's full-sized avatar

Andy Wilson wilsonat

View GitHub Profile
@wilsonat
wilsonat / ModelMetadataConventions.cs
Last active December 26, 2015 02:28
A couple examples of the convention-based metadata provider I created.
// All conventions implement this interface. The "Apply" method is responsible for determining if a convention
// applies, as well as the actual transformation of the metadata. (I'm working on an enhanced version that
// separates the "is a match" logic from the actual metadata application.)
public interface IMetadataConvention
{
void Apply(IEnumerable<Attribute> attributes, ModelMetadata metadata);
}
// This convention applies our default naming convention. This convention will split a "pascal-cased" property name
// into individual words. For example, "BorrowerFirstName" would become "Borrower First Name". This convention can
@wilsonat
wilsonat / TrimmedString.cs
Created December 6, 2012 16:41
NHibernate user type to trim char(n) columns
public class TrimmedString : IUserType
{
public bool IsMutable
{
get { return false; }
}
public Type ReturnedType
{
get { return typeof (string); }
}