Home
  |   Login

Field is Transient error in OpenAccess ORM

Mar 14

Written by:
3/14/2010 12:10 PM  RssIcon

When building a Visual Studio Project that used OpenAccess ORM I started receiving an error similiar to below:

The property 'ProductID' of type 'ProductInfo' is declared to be an query alias for field 'productid', but the aliased field is transient and not present in the database.

This error can happen for a few different reasons.  Here are 2 solutions that have worked for me.

  •  Check in fact that the field you are referencing is not marked as transient in your class file.  Also check the OpenAccess config in your project to make sure that the field is defined. 

Also make sure that all your properties have the [FieldAlias] attribute defined.  Here is an example:

private int mydata;
 
[FieldAlias("mydata")]
public int MyProperty
{
get { return mydata;}
set { mydata = value;}
}

 

  • If you are using ORM Q1 2010 or beyond and you have recently added a Domain Model to your project you may also receive this error.  You should create your Domain Model in a new project.  OpenAccess does not support a mix of Forward/Reverse mapping with Domain Model mapping.   The  enhancer is called using slightly different parameters depending upon what type of project you are creating.

To fix this error requires 2 steps.  

  1. Delete the Domain Model you have added to your project.
  2. Open your .csproj file in a editor ( notepad )  and comment out the following line

    <Import Condition="Exists('$(MSBuildExtensionsPath)\OpenAccess.targets')" Project="$(MSBuildExtensionsPath)\OpenAccess.targets" />

    You should find it right at the end of the file

 

 

Here is a blog post on Telerik's Forum that I opend regarding this error

 

 

 

Tags:
Categories: Telerik
Location: Blogs Parent Separator Repetti Net

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 

Search

Minimize
Archive
<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910
Monthly
Go