0

I was following this tutorial

http://gergroen.blogspot.de/2011/11/nhibernate-getting-started-guide.html

and I had no problem with it and everything so far was clear.

My problem arose when I tried referencing another DLL where I have some large infrastructure data schemas. This DLL is full of objects to be filled with a Postgres DB and of course, all the properties has the virtual statement so it's possible the SQLite Lazy Loading.

I am trying to do a Mock Up project, to make tests while the final DB Schema is finally done but as soon as I reference my external DLL, I get problems.

As I compile, I get the following error:

Error 2 The type or namespace name 'External' could not be found (are you missing a using directive or an assembly reference?) C:\Users\john\Downloads\NHibernate-getting-started-guide-master\NHibernate-getting-started-guide-master\NHibernate.GettingStarted\Model\IMedicineRepository.cs 1 7 NHibernate.GettingStarted

Where the code is (this same code doesn't break when I reference a class within the same namespace, as the tutorial above shows):

using External.Infrastructure.Medicine;
using System;

namespace NHibernate.GettingStarted.Model
{
    public interface IMedicineRepository
    {
    /// <summary>
    /// Get person entity by id
    /// </summary>
    /// <param name="id">id</param>
    /// <returns>person</returns>
    Medicine Get(Guid id);

    /// <summary>
    /// Save person entity
    /// </summary>
    /// <param name="person">person</param>
    void Save(Medicine medicine);

    /// <summary>
    /// Update person entity
    /// </summary>
    /// <param name="person">person</param>
    void Update(Medicine medicine);

    /// <summary>
    /// Delete person entity
    /// </summary>
    /// <param name="person">person</param>
    void Delete(Medicine medicine);

    /// <summary>
    /// Row count person in db
    /// </summary>
    /// <returns>number of rows</returns>
    long RowCount();
}

}

I have read a little and it seems like all the projects have to be within the same namespace, which makes sense when I try with the tutorial to do it.

The only diference between the projects are that I just referenced one object from another Assembly.

Does anyone have any idea on how could I fix it? or maybe my approach is wrong?

EDIT 1:

Another good question to understand the problem would be: How do I reference data objects from another assembly? I think there is where I have the problem.

C3PO
  • 147
  • 4
  • 15

1 Answers1

0

Ok, after looking deeper and deeper... I found that this was the problem:

Referenced Project gets "lost" at Compile Time

One project was compiled with the 4.5 Framework and the other with 4.0.

I switched both to 4.5 and now it works!

Hope this can help someone else.

Community
  • 1
  • 1
C3PO
  • 147
  • 4
  • 15