Hi there

I am working in a prototype with fluent nhibernate 1.0 and nhibernate
2.1. So far the rules seemed logical to me. But now I have some kind
of troubles getting the fk of the parent to the child's table.

I have 3 tables(simplified):

Log:
-ID
-Type

LogEntry:
-ID
-Log_Id
-Action

LogEntryValues:
-ID
-LogEntry_Id
-Value

The classes are quite simple, Log and LogEntry have each a a iList of
their childs which can be null.

The mapping looks like this:
public class LogMap : ClassMap<Log>
    {
        LogMap()
        {
            LazyLoad();
            Id(x => x.Id);
            Map(x => x.Type);
            HasMany(x => x.LogEntries).Inverse().Cascade.All();
        }
    }

    public class LogEntryMap : ClassMap<LogEntry>
    {
        LogEntryMap()
        {
            LazyLoad();
            Id(x => x.ID);
            Map(x => x.action).CustomType(typeof
(Enumerations.Enumerators.DatabaseActions));
            HasMany(x => x.LogValues).Inverse().Cascade.All();
        }
    }

    public class LogEntryValuesMap : ClassMap<LogEntryValues>
    {
       LogEntryValuesMap()
        {
            LazyLoad();
            Id(x => x.ID);
            Map(x => x.Value);
            ReadOnly();
        }
    }

What I think might be wrong is the configuration of fluent nhibernate:
private static ISessionFactory SessionFactory
        {
            get
            {
                if (sessionFactory == null)
                {

                    try
                    {
                        String luceneIndexPath =
AppDomain.CurrentDomain.SetupInformation.ApplicationBase +
@"\Lucene_index";
                        if (!System.IO.Directory.Exists
(luceneIndexPath))
                            System.IO.Directory.CreateDirectory
(luceneIndexPath);


                        sessionFactory = Fluently.Configure()
                                        .Database
(MsSqlConfiguration.MsSql2005
                                                .ConnectionString(c =>
c.Is(connectionString))
                                                .ShowSql()
                                                .ProxyFactoryFactory
("NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu "))
                                            .Mappings(m =>
m.FluentMappings.AddFromAssemblyOf<AxendoAnmeldung>())
                                            .ExposeConfiguration(x =>
                                                {
                                                    //
NHibernate.Search Config
                                                    //x.SetProperty
("hibernate.search.default.directory_provider", typeof
(RAMDirectoryProvider).AssemblyQualifiedName);

                                                    x.SetProperty
("hibernate.search.default.directory_provider", typeof
(FSDirectoryProvider).AssemblyQualifiedName);
                                                    x.SetProperty
("hibernate.search.default.indexBase", luceneIndexPath);


                                                    //NHibernate
Config
                                                    x.SetProperty
("current_session_context_class", "web");
                                                })
                                          .BuildSessionFactory();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                return sessionFactory;
            }
        }

My Database is MS SQL Server 2005, the fk's are set to their
corresponding parent-ids.

Any hints what's missing?

Regards

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to