How to create a custom property not mapped to table column
Posted: Fri 12 Mar 2010 20:00
In previous LINQ projects I often manually add new properties to existing auto-generated LINQ classes, using the magic of partial classes. These are straight Microsoft LINQ / SQL Server projects and I did *not* include an attribute for these properties. When I tried the same with my devart/Oracle LINQ project I got the following error:
Cannot find metainformation for property User.MyManuallyAddedProperty. Please check that the property is mapped to the table column.
It appears my new property must have an attribute set, so I included an attribute even though this property is not mapped to any database column:
[Column(Name = @"MyManuallyAddedProperty")]
I expected to get an oracle error:
ORA-00904: "T2"."MYMANUALLYADDEDPROPERTY": invalid identifier
I then changed the property attribute to:
[Column(IsDbGenerated = false)]
Which I hoped would indicate no database access, but yet another oracle error was thrown on runtime.
My question is how to I add a property that is *not* mapped to a column in the database?
Thank you,
Donald Lee-
Dept. of Energy - National Science Research Center
dotConnect for Oracle 5.60 Beta
*** Example partial class code *******************************
// This file is intended to be edited manually
public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
{
[Column(IsDbGenerated = false)] //error thrown if no attribute!
public string MyManuallyAddedProperty
{
get { return "hello"}
}
}
Cannot find metainformation for property User.MyManuallyAddedProperty. Please check that the property is mapped to the table column.
It appears my new property must have an attribute set, so I included an attribute even though this property is not mapped to any database column:
[Column(Name = @"MyManuallyAddedProperty")]
I expected to get an oracle error:
ORA-00904: "T2"."MYMANUALLYADDEDPROPERTY": invalid identifier
I then changed the property attribute to:
[Column(IsDbGenerated = false)]
Which I hoped would indicate no database access, but yet another oracle error was thrown on runtime.
My question is how to I add a property that is *not* mapped to a column in the database?
Thank you,
Donald Lee-
Dept. of Energy - National Science Research Center
dotConnect for Oracle 5.60 Beta
*** Example partial class code *******************************
// This file is intended to be edited manually
public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
{
[Column(IsDbGenerated = false)] //error thrown if no attribute!
public string MyManuallyAddedProperty
{
get { return "hello"}
}
}