This is a migrated thread and some comments may be shown as answers.

DataStoreException with Transient field

2 Answers 73 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Craig
Top achievements
Rank 1
Craig asked on 28 Mar 2013, 04:40 PM
Hello,
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?

Regards,
Craig
(OpenAccess ORM Q1 2013)

using System;
using System.Linq;
 
namespace MyNameSpace
{
    public partial class MyType
    {
        private string _extraProperty;
        [Telerik.OpenAccess.Transient]
        public string ExtraProperty
        {
            get
            {
                return this._extraProperty;
            }
            set
            {
                this._extraProperty= value;
            }
        }
    }
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Boris Georgiev
Telerik team
answered on 29 Mar 2013, 04:24 PM
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;
03.  
04.namespace MyNameSpace
05.{
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.    }
22.}

I hope that helps.

All the best,
Boris Georgiev
the Telerik team
Free Webinar: OpenAccess Integration in Sitefinity. SIGN UP NOW.
0
Craig
Top achievements
Rank 1
answered on 08 Apr 2013, 01:08 PM
Thanks Boris. That was it.
Tags
Development (API, general questions)
Asked by
Craig
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Craig
Top achievements
Rank 1
Share this question
or