Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3978880
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:06:06+00:00 2026-05-20T05:06:06+00:00

Hy guys, I’ve searched all over the web and didn’t find a solution to

  • 0

Hy guys,

I’ve searched all over the web and didn’t find a solution to this problem…

This is my entity…

    public class Pedido : IKeyed<int>
{
    public virtual int Id { get; private set; }
    public virtual string Assunto { get; set; }
    public virtual string Data { get; set; }
    public virtual Categoria Categoria{ get; set; }
    public virtual Modulo Modulo { get; set; }
    public virtual Pessoa Pessoa { get; set; }
    public virtual Site Site { get; set; }
    public virtual Situacao Situacao { get; set; }
    public virtual IList<Interacao> Interacao { get; set; }

    public Pedido()
    {
        Interacao = new List<Interacao>();
    }

    public virtual void addCategoria(Categoria categoria)
    {
        Categoria=categoria;
    }

    public virtual void addInteracao(Interacao interacao)
    {
        interacao.Pedido = this;
        Interacao.Add( interacao );
    }

}

The classMap…

    public class PedidoMap : ClassMap<Pedido>
{
    PedidoMap()
    {
        Table( "z1_pedido" );
        Id( x => x.Id );
        Map( x => x.Assunto );
        Map( x => x.Data );
        References( x => x.Categoria ).Column( "Id" );
        References( x => x.Modulo ).Column( "Id" );
        References( x => x.Pessoa ).Column( "Id" );
        References( x => x.Site ).Column( "Id" );
        References( x => x.Situacao ).Column( "Id" );
        HasMany( x => x.Interacao ).LazyLoad().Inverse().Cascade.All();

    }
}

My Repository:

public class Repository<T> : NHibernateContext, IKeyedRepository<int, T> where T : class, IKeyed<int>
{
    private readonly ISession _session;

    public Repository(ISession session)
    {
        _session = session;
    }

    public bool Add(T entity)
    {
        _session.Save( entity ); "<-- Here's where the debug stops and display the error"
        return true;
    }

The test method:

                UnitOfWork unitOfWork = new UnitOfWork( helper.SessionFactory );

            Repository<Pedido> repository = new Repository<Pedido>( unitOfWork.Session );

            Pedido pedido = CreatePedido( string.Format( "Pedido {0}", i + 1 ), 10 );
            repository.Add( pedido ); "<-- Call the Repository."

            unitOfWork.Commit();
        }

Please Guys… helpe me!

Thks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:06:06+00:00Added an answer on May 20, 2026 at 5:06 am

    You need to configure FluentNhibernate to look for mappings in the assembly where the PedidoMap class resides. Something like this:

            var fluentConfig = Fluently.Configure();
            fluentConfig.Mappings(m => 
                m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()));
            var cfg = fluentConfig.BuildConfiguration();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

guys. I have a strange problem. I try to write unit-tests to web-app. I
Guys, I've came across this problem I can't resolve myselg, I'm pretty sure I
Guys, I am very new to c++. I have just wrote this class: class
Guys, I have been surfing thru the web to find a way that I
Guys Please help me to solve this floating problem.I tried different methods but anything
guys. I met this problem this afternoon. I don't want a different span.... My
Guys, what is function called after my class loaded, where i can call self
Guys I'm getting this really weird fault with my program when I run it.
guys i'm still new on developing system and I've encountered this This is the
Guys i need some help here , im getting this error here at the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.