I'm not sure why your extra columns weren't generated. But I can answer your
second question regarding the Configuration parameter to the BuildSchema
method. The Configuration class is a NHibernate class that is the central
point for configuring NHibernate. Fluent NHibernate creates and wraps one
when you call Fluently.Configure(), and then passes it to the method you
provide in the ExposeConfiguration call. You can also create your own
Configuration instance and pass that instead, using the
Fluently.Configure(Configuration config) overload. Some people have to do
this because they need to specify particular configuration options that
Fluent NHibernate is unaware of.

On Sat, Dec 12, 2009 at 9:51 AM, macap <[email protected]> wrote:

> Hello,
>
> I´m trying to make my first experiences with Fluent NHIbernate.
> For that reason I started to play with the Exmaples.FirstProject
> example containing in the Visual Studio Solution of Fluent NHibernate.
>
> Because I want to use MS SQL 2008 Server,
> I´ve changed the Sqlite into MS SQL 2008:
>
>
>   private static ISessionFactory CreateSessionFactory()
>        {
>             return Fluently.Configure()
>
>                 .Database
> (MsSqlConfiguration.MsSql2008.ConnectionString(@"Data Source=.
> \SQLEXPRESS;Initial Catalog=FluentHibernateQuickStart;Integrated
> Security=true"))
>
>                 .Mappings(m =>
>                    m.FluentMappings.AddFromAssemblyOf<Program>())
>                .ExposeConfiguration(BuildSchema)
>                .BuildSessionFactory();
>
>              //SQLiteConfiguration.Standard
>              //      .UsingFile(DbFile))
>        }
>
>
> and I´ve deactivated the use of files:
>
>
> private static void BuildSchema(Configuration config)
>        {
>            // delete the existing db on each run
>            //if (File.Exists(DbFile))
>            //    File.Delete(DbFile);
>
>            // this NHibernate tool takes a configuration (with
> mapping info in)
>            // and exports a database schema from it
>            new SchemaExport(config)
>                .Create(false, true);
>        }
>
>
>
>
> As I saw, the tables are generated automatically when I run the
> program.
>
>
> As next step I wanted to add CreateDate and ChangeDate columns to
> every table.
> So I changed my entities and added 2 new properties:
>
>        public virtual DateTime CreateDate { get; set; }
>        public virtual DateTime ChangeDate { get; set; }
>
> I also added DateTime.Now in the Program.cs file to add the DateTimes
> to my entities.
>
> For example I replaced:
>
>     var barginBasin = new Store { Name = "Bargin Basin" };
>
> into:
>
>     var barginBasin = new Store { Name = "Bargin Basin",
> CreateDate=DateTime.Now, ChangeDate=DateTime.Now };
>
>
>
> I deleted the tables and run the program again,
> but my new CreateDate and ChangeDate columns are not created and I do
> not know why.
>
> Can anybody tell me what I have to do?
>
> I also do not understand where the Configuration config object comes
> from which is used in the
>  private static void BuildSchema(Configuration config)
> method of Program.cs.
>
> So it would be nice if anybody can give me a link or a short
> explaination :-)
>
>
> Regards,
>
> Martin
>
>
>
>
>
>
> --
>
> 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]<fluent-nhibernate%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>
>

--

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.


Reply via email to