AutoMapping and Default Values

Original Post trondaron's Avatar

trondaron

31 Mar, 2010 05:30 PM via web

I am auto mapping my objects, but wish for my strings to default to empty strings, not null.
I tried making a IAutoMappingOverride with this:

        mapping.Map(x => x.NameMiddle).Default(string.Empty);

When the NameMiddle value is never set before SaveOrUpdate() call I still get generated SQL that attempts insert a null value.

How do I set default values for all strings, or for specific properties?
Even just pointing me to a resource that worked for you would help, I've found next to nothing (possibly I'm just not searching for the proper words).

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      What month comes before July?

      Recent Discussions

      05 Jul, 2010 10:29 PM
      05 Jul, 2010 12:45 PM
      05 Jul, 2010 12:42 PM
      05 Jul, 2010 12:17 PM
      05 Jul, 2010 12:12 PM

       

      03 Jul, 2010 12:26 AM
      02 Jul, 2010 02:17 PM
      02 Jul, 2010 08:18 AM
      02 Jul, 2010 12:20 AM
      01 Jul, 2010 10:14 PM