FYI: still not fixed using the latest Fluent NHibernate code (last modified Feb 26, 2009).
On Feb 18, 6:48 pm, x97mdr <[email protected]> wrote: > *bump* > > Just wondering if this issue was ever resolved? > > On Feb 15, 3:30 pm, fmorriso <[email protected]> wrote: > > > > > For what it's worth, here's the code for my temporary work-around. > > Put it after this line in Program.cs: > > > var joan = new Employee { FirstName = "Joan", LastName = "Pope" }; > > > // added by Fred Morrison because Store objects > > don't seem to save the Employee's > > // that work in the store. > > var employees = new List<Employee>() { daisy, > > jack, sue, bill, joan }; > > foreach (var employee in employees) > > { > > session.SaveOrUpdate(employee); > > Console.WriteLine(employee.Id); > > } > > > On Feb 12, 5:56 pm, James Gregory <[email protected]> wrote: > > > > Somebody else just raised this exact issue today, I'll investigate asap. > > > Thanks. > > > > On Thu, Feb 12, 2009 at 9:20 PM, fmorriso <[email protected]> wrote: > > > > > I'm running the Examples.FirstProject using Microsoft SQL Server 2008 > > > > Developer Edition and Visual Studio 2008 SP1, .Net Framework 3.5 SP1 > > > > and it does not generate any INSERT's for the Employee table. > > > > > The narrative for the example indicates that saving a Store object > > > > should auto-generate any necessary Employee INSERT's, but the output > > > > on the console shows only INSERT's for Store, Product and > > > > StoreProduct. A SELECT * FROM dbo.[Employee] returns zero rows. > > > > > There aren't very many changes needed to switch the example to use SQL > > > > Server 2008, but perhaps one or more of those changes I made could > > > > have disabled the automatic generation of Employee INSERT > > > > statements? I hate to post tons of code, so if somebody could email > > > > me to show me how to upload the code, I'd be glad to share it - and > > > > maybe learn something in the process. > > > > > Here's just a small example of a change I made to allow the example to > > > > use SQL Server 2008. Hopefully, I didn't mess it up too bad: > > > > > /// <summary> > > > > /// Sets up the required NHibernate session factory > > > > /// </summary> > > > > /// <returns>ISessionFactory instance</returns> > > > > private static ISessionFactory CreateSessionFactory() > > > > { > > > > string connString = GetDatabaseConnectionString(); > > > > Console.WriteLine(connString); > > > > > // Use Fluent NHibernate instead of an NHibernate XML > > > > config file > > > > return Fluently.Configure() > > > > .Database(MsSqlConfiguration.MsSql2005 > > > > .ConnectionString(c => c.Is(connString)) > > > > .ShowSql() > > > > .DefaultSchema("dbo") > > > > ) > > > > .Mappings(m => m > > > > .FluentMappings.AddFromAssemblyOf<Program>() > > > > ) > > > > //WARNING: will DROP/CREATE tables .ExposeConfiguration > > > > (BuildSchema) > > > > .BuildSessionFactory(); > > > > } > > > > > I built the database myself (so I'm a control freak, sue me) rather > > > > than end up with weird PK and FK constraint names. > > > > > The DDL for the Employee table looks like this: > > > > > CREATE TABLE [dbo].[Employee]( > > > > [Id] [int] IDENTITY(1,1) NOT NULL, > > > > [LastName] [nvarchar](100) NOT NULL, > > > > [FirstName] [nvarchar](100) NOT NULL, > > > > [Store_id] [int] NULL, > > > > CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED > > > > ( > > > > [Id] ASC > > > > )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY > > > > = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] > > > > ) ON [PRIMARY] > > > > > GO > > > > > ALTER TABLE [dbo].[Employee] WITH NOCHECK > > > > ADD CONSTRAINT [FK_Employee_Store] FOREIGN KEY([Store_id]) > > > > REFERENCES [dbo].[Store] ([Id]) > > > > GO > > > > > ALTER TABLE [dbo].[Employee] CHECK CONSTRAINT [FK_Employee_Store] > > > > GO > > > > > The DDL for Store looks like this: > > > > > CREATE TABLE [dbo].[Store]( > > > > [Id] [int] IDENTITY(1,1) NOT NULL, > > > > [Name] [nvarchar](100) NOT NULL, > > > > CONSTRAINT [PK_Store] PRIMARY KEY CLUSTERED > > > > ( > > > > [Id] ASC > > > > )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY > > > > = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] > > > > ) ON [PRIMARY] > > > > > GO- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
