DataStoreException with Transient field

3 posts, 1 answers
  1. Craig
    Craig avatar
    112 posts
    Member since:
    Nov 2011

    Posted 28 Mar 2013 Link to this post

    I'm trying to add a transient field to one of my entities. I've created a partial class in the OpenAccess project (example below) but when I run my application I get a DataStoreException: Invalid column name.
    I want the client to see the transient field as an extra property of the class but I don't want it referred to when reading the data from the database. I thought this would be achieved using Transient attribute.
    What have I missed?

    (OpenAccess ORM Q1 2013)

    using System;
    using System.Linq;
    namespace MyNameSpace
        public partial class MyType
            private string _extraProperty;
            public string ExtraProperty
                    return this._extraProperty;
                    this._extraProperty= value;
  2. Answer
    Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 29 Mar 2013 Link to this post

    Hi Craig, 

    When you are using Attributes Mapping Type you should mark the field with [Transient] attribute, not the property. If you are using Fluent Mapping, then you should mark the property as transient by using the AsTransient() method.

    For example in your case:
    01.using System;
    02.using System.Linq;
    04.namespace MyNameSpace
    06.    public partial class MyType
    07.    {
    08.        [Telerik.OpenAccess.Transient]
    09.        private string _extraProperty;
    10.        public string ExtraProperty
    11.        {
    12.            get
    13.            {
    14.                return this._extraProperty;
    15.            }
    16.            set
    17.            {
    18.                this._extraProperty= value;
    19.            }
    20.        }
    21.    }

    I hope that helps.

    All the best,
    Boris Georgiev
    the Telerik team
    Free Webinar: OpenAccess Integration in Sitefinity. SIGN UP NOW.
  3. DevCraft banner
  4. Craig
    Craig avatar
    112 posts
    Member since:
    Nov 2011

    Posted 08 Apr 2013 Link to this post

    Thanks Boris. That was it.
Back to Top