Addon doesn't do anything.

May 25, 2011 at 9:53 PM

Hello,

I am having significant issues with writing HQL statements using NHibernate.
They constantly error on application startup and no reasonable errors are reported. It simply says "error" in named queries X,Y,Z. 

I installed HQLAddin.
I added the intelliscense exporting class like it says in the documentation.

I go into my .hbm.xml file and I get nothing except for minor highlight, on lower cased words only as well.
Not even object highlighting, just HQL reserved word highlighting.

I am using NHibernate, with Fluent and StructureMap.

I have a domain assembly which has all the classes used with nhibernate.
I have a infrastructure assembly which has all the repositories and overrides/mapping in them.

I do not have any XML mapping. Everything is strongly typed inside Fluent auto mapping override interfaces.

I also tried the same thing on another devs machine, he also had the same experience: Nothing.

I can't figure this out for the life of me and I need help with my HQL queries because there always seems to be something going wrong while I convert all our code to NHibernate.

I copied the configuration exporter class from a previous discussion:

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;
            }
        }
    }
}

I added this class to the infrastructure assembly.

May 25, 2011 at 9:55 PM
Hi Digital, would you mind to send me an small solution in a zip file?
I am affraid than there are lot of variables going on.

Thank you,

2011/5/25 digitalpacman <notifications@codeplex.com>

From: digitalpacman

Hello,

I am having significant issues with writing HQL statements using NHibernate.
They constantly error on application startup and no reasonable errors are reported. It simply says "error" in named queries X,Y,Z.

I installed HQLAddin.
I added the intelliscense exporting class like it says in the documentation.

I go into my .hbm.xml file and I get nothing except for minor highlight, on lower cased words only as well.
Not even object highlighting, just HQL reserved word highlighting.

I am using NHibernate, with Fluent and StructureMap.

I have a domain assembly which has all the classes used with nhibernate.
I have a infrastructure assembly which has all the repositories and overrides/mapping in them.

I do not have any XML mapping. Everything is strongly typed inside Fluent auto mapping override interfaces.

I also tried the same thing on another devs machine, he also had the same experience: Nothing.

I can't figure this out for the life of me and I need help with my HQL queries because there always seems to be something going wrong while I convert all our code to NHibernate.

I copied the configuration exporter class from a previous discussion:

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;
            }
        }
    }
}

I added this class to the infrastructure assembly.

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


May 25, 2011 at 10:02 PM

I don't really have one to give you and our solution is huge.

One thing is there is NO SUCH TYPE of NHibernate.Cfg.Configuration.

Infact NHibernate.Cfg has no public classes for me to use.

May 25, 2011 at 10:05 PM

To setup inhibernate again like the way we do would probably take me a few days.

I can try setting up a smaller project but I don't know if I'll be able to.

I think it has something to do with there being no such configuration type like you are asking for.

May 25, 2011 at 10:07 PM
no problem, I will send you a working example ASAP.
May 25, 2011 at 10:20 PM
sorry, digital pacman I remember there was a solution as an example in the repository of the project...
folder "Example\Source"

I just installed HqlAddin and open that solution and everything was working ok.

2011-05-25_1819.png
if the addin fails, you have to close and open VS again.

Try with my solution and do not hesitate to contact me know if you find any problem
Thanks
May 25, 2011 at 10:27 PM

Well I found out what the configuration problem was.

Some guy here made an NHibernate namespace and it was referring to ours not the real NHibernate namespace.

So I fixed how thats linking up but it's still not working.

I don't understand how this works? Do I have to run something or what? How does this configuration class allow me to get intelliscense?

Don't I have to tell the extension to go "hey look here" or something?

Do I have to build first?

I'll try that solution now.

May 25, 2011 at 10:29 PM
Yes, you have to build your code. The addin will detect that you build something, will find the paths where your assemblies are... then it will load these assemblies in an isolated environment read the nhibernate metadata to populate the intellisense in-memory db.



2011/5/25 digitalpacman <notifications@codeplex.com>

From: digitalpacman

Well I found out what the configuration problem was.

Some guy here made an NHibernate namespace and it was referring to ours not the real NHibernate namespace.

So I fixed how thats linking up but it's still not working.

I don't understand how this works? Do I have to run something or what? How does this configuration class allow me to get intelliscense?

Don't I have to tell the extension to go "hey look here" or something?

Do I have to build first?

I'll try that solution now.

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


May 25, 2011 at 10:31 PM

Can't open the example project. VS won't have it.

"Cannot be opened"
"The project type is not supported by this installation." 

I'm running VS 2010 Professional
10.0.40219.1 SP1Rel 

May 25, 2011 at 10:40 PM

If this helps, this is how my application loads the configuration for nhibernate:

 

        Dim dllsToLoad(0) As String
        dllsToLoad(0) = "Company.Domain"
        NHibernateSession.ConfigurationCache = New NHibernateConfigurationFileCache(dllsToLoad)
        dllsToLoad(0) = Server.MapPath("~/bin/Company.Infrastructure.dll")

            NHibernateSession.Init(webSessionStorage, _
                                    dllsToLoad,
                                    New AutoPersistenceModelGenerator().Generate(),
                                    Server.MapPath("~/Config/NHibernate.config"))


 

 

May 25, 2011 at 10:59 PM

The plugging doesn't care your application starting point. It looks for an [Export] ... 

Do you have c# installed?

May 25, 2011 at 11:02 PM

Yes I have C# installed.

It's just that our website is in VB.NET, but all the core is written in C# which is what I deal with.