Pages

Wednesday, May 23, 2012

Orchard column with NotNull option

Yesterday I had a trouble with the option NotNull in Orchard’s migration:
SchemaBuilder.CreateTable("SkillPartRecord",
    table => table
        .ContentPartRecord()
        .Column<string>("SkillName", c => c.NotNull())
        .Column<int>("Knowledgment", c => c.NotNull().WithDefault(0)));


I did a lot of debugging with a collegue of mine that help me with Orchard (he has a more extensive experience that I have with Orchard).

So we have found the problem; specify this option in a string column seems to has somes problem with the NHibernate persistence, so the data is not saved Disappointed smile

I will do other checks to be sure!

Added: I forgot, I talking about Orchard 1.4.2 with NHibernate v2.0.50727

1 comment:

  1. You saved my day. NotNull is not working for ContentPartRecords, but it works perfectly for custom Records.

    ReplyDelete