I am tring to do a sample exemple using Fluent NHibernate but i am having some dificults
this is my code: * public class Categoria* * {* * public virtual int Id { get; protected set; }* * public virtual string Descricao { get; set; }* * }* *public class CategoriaMap : ClassMap<Categoria>* * {* * public CategoriaMap()* * {* * //Table("Categoria");* * Id(x => x.Id);//.Column("Id").CustomType("System.Int32").GeneratedBy.Identity();* * Map(x => x.Descricao);* * } * * }* here is the insert method on my DAO: * public string incluir(Categoria entidade)* * {* * String resultado = null;* * ISession session = null;* * ITransaction transaction = null;* * try* * {* * session = HibernateHelper.OpenSession();* * transaction = session.BeginTransaction();* * resultado = (string)session.Save(entidade);* * transaction.Commit();* * }* * catch (Exception e)* * {* * resultado = e.Message;* * transaction.Rollback();* * }* * finally* * {* * if (transaction.IsActive && !transaction.WasCommitted)* * {* * transaction.Commit();* * }* * }* * return resultado;* * }* my table script: *CREATE TABLE [dbo].[Categoria](* * [Id] [int] IDENTITY(1,1) NOT NULL,* * [Descricao] [varchar](50) NULL,* * CONSTRAINT [PK_Categoria] PRIMARY KEY CLUSTERED * *(* * [Id] ASC* *)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]* *) ON [PRIMARY]* when i run my project, i receive this erro: *NHibernate: INSERT INTO [Categoria] (Descricao) * *VALUES (@p0); select SCOPE_IDENTITY();* *@p0 = 'Categoria A' [Type: String (4000)]* *Unable to cast object of type 'System.Int32' to type 'System.String'.* Does anybody knows how to resolve it? -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To unsubscribe from this group and stop receiving emails from it, send an email to fluent-nhibernate+unsubscr...@googlegroups.com. To post to this group, send email to fluent-nhibernate@googlegroups.com. Visit this group at https://groups.google.com/group/fluent-nhibernate. For more options, visit https://groups.google.com/d/optout.