AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

Exception: MissingSetterException

Posted by Gerhard Stephan on April 17th, 2008

The MissingSetterException will be thrown if a value object shall be loaded that has a property without a setter.

    /// <summary>

    /// This is an uncomplete value object that throws a missing setter exception

    /// </summary>

    public class MissingSetter : ValueObject


        private string missing = string.Empty;


        public string Missing


            get { return missing; }



The following test will throw the MissingSetterException when trying to load the object.



        public void TestMissingSetterException()


            MissingSetter missingSetter = new MissingSetter();


            using (AdFactum.Data.ObjectMapper mapper = OBM.CreateMapper(Connection))


                // First save

                bool nested = OBM.BeginTransaction(mapper);


                OBM.Commit(mapper, nested);


                // The Load throws the MissingSetterException, because the value can’t be set to the object.

                ObjectDumper.Write(mapper.Load(typeof (MissingSetter), missingSetter.Id));



Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>