Problems with IntelliSense

Dec 9, 2010 at 10:36 AM

I have problems getting the intellisense to work. Since I have a hibernate.cfg.xml file and is using FluentlyNHibernate this is my ConfigurationExporter.

 

    public class ConfigurationExporter
    {
        [Export(typeof(ConfigurationExporter))]
        public static Configuration Configuration
        {
            get
            {
                var cfg = new NHibernate.Cfg.Configuration();
                cfg.Configure();
                Fluently.Configure(cfg)
                    .Mappings(
                        m =>
                            {
                                m.FluentMappings
                                    .AddFromAssemblyOf<ConfigurationExporter>();
                                m.HbmMappings.AddFromAssemblyOf<ConfigurationExporter>();
                        })
                    .BuildSessionFactory();
                return cfg;
            }
        }
    }
The HqlAddin output however keeps telling me:
There was an error building your NHibernate configuration: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Any suggestions?

 

Coordinator
Dec 9, 2010 at 12:46 PM

Would you mind to provide me a minimal project in a zip to test?

Thank you very much

Dec 9, 2010 at 1:45 PM

The project is quite large but I can create a smaller project for you to test :)

Coordinator
Dec 9, 2010 at 1:59 PM
Thank you very much Hansos, that will be quite useful for me.

2010/12/9 hansos <notifications@codeplex.com>

From: hansos

The project is quite large but I can create a smaller project for you to test :)

Read the full discussion online.

To add a post to this discussion, reply to this email (hqladdin@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email hqladdin@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 9, 2010 at 3:34 PM

Hi there again..

Here is a simple project I made in which the IntelliSense does not work on the entities.

http://www.2shared.com/file/ydIDCV22/TestHqlAddon.html

Thanx for the fast reply. :)

Coordinator
Dec 10, 2010 at 12:36 AM
Thanks a lot, id have a look as soon as posible

2010/12/9, hansos <notifications@codeplex.com>:
> From: hansos
>
> Hi there again..Here is a simple project I made in which the IntelliSense
> does not work on the
> entities.http://www.2shared.com/file/ydIDCV22/TestHqlAddon.htmlThanx for the
> fast reply. :)
>
>

--
Enviado desde mi dispositivo móvil
Coordinator
Dec 13, 2010 at 8:37 PM

Sorry for the delay, i've looked in your solution and i've seen this:

  1. There might be a problem with the hqladdin or with MEF, that doesn't take exported values from executables, so i've changed the TestHqlAddon project to library.
  2. Your ConfigurationExporter class was exporting ConfigurationExporter instead of NHibernate.Cfg.Configuration
  3. There was a problem when doing BuildSessionFactory at the end of FNH configuration, you don't need to build SF, just the configuration.

So, I've intellisense working on your example, the configuration exporter looks as follows:

using System.ComponentModel.Composition;
using FluentNHibernate.Cfg;
using NHibernate.Cfg;

namespace TestHqlAddon
{
    public class ConfigurationExporter
    {
        [Export(typeof(Configuration))]
        public static Configuration Configuration
        {
            get
            {
                var cfg = new Configuration();
                cfg.Configure();
                Fluently.Configure(cfg)
                    .Mappings(
                        m =>
                        {
                            m.FluentMappings
                                .AddFromAssemblyOf<ConfigurationExporter>();
                            m.HbmMappings.AddFromAssemblyOf<ConfigurationExporter>();
                        }).BuildConfiguration();
                return cfg;
            }
        }
    }
}

Let me know if this fix your problems. Thank you very much

Dec 14, 2010 at 9:14 AM

Hi again.

The second and third point fixed my problem. Now it's working like a charm. Thank you very much for your help.

:)

Dec 14, 2010 at 9:23 AM

Hi again. :)

Well.. I was a little bit fast there. The IntelliSense do work in simple queries, but not in those where I use left join.

Coordinator
Dec 14, 2010 at 11:43 AM
would you mind to get me an example of query? (just the query, i don't need a full solution).

thank you very much

2010/12/14 hansos <notifications@codeplex.com>

From: hansos

Hi again. :)

Well.. I was a little bit fast there. The IntelliSense do work in simple queries, but not in those where I use left join.

Read the full discussion online.

To add a post to this discussion, reply to this email (hqladdin@discussions.codeplex.com)

To start a new discussion for this project, email hqladdin@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 16, 2010 at 7:53 AM

Hi there. Sorry for the late response. :) Here is an example of a query where IntelliSense does not work.

    select act from Activity act
    left join act.Car car
    left join car.CarDrivers cd
    left join cd.Driver driver
    where cd.IsActive = true
    and (driver.UniqueIdentifier = :uniqueIdentifier)