Skip to content

Instantly share code, notes, and snippets.

@dgomesbr
Created February 9, 2012 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgomesbr/1782770 to your computer and use it in GitHub Desktop.
Save dgomesbr/1782770 to your computer and use it in GitHub Desktop.
Mapeamento da classe Categoria no NHibernate 3.2
using NHibernate.Driver;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;
namespace workshop_Entity
{
public class Category
{
public virtual int IdCategoria { get; set; }
public virtual string Nome { get; set; }
public virtual string Descricao { get; set; }
}
public class CategoryMap : ClassMapping<Category>
{
public CategoryMap()
{
Id(x => x.IdCategoria, m => m.Generator(Generators.Identity));
Property(x => x.Nome, m => m.Length(SqlClientDriver.MaxSizeForLengthLimitedString + 1));
Property(x => x.Descricao, m => m.Length(SqlClientDriver.MaxSizeForLengthLimitedString + 1));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment