c# - Entity Framework foreign key problems on Oracle - code-first -


i have following mapping using code-first:

{     /// <summary>     /// entity framework dc.dc database table object representation     /// </summary>     [table("dcdc", schema = "mzmesdb")]     public class efdcdc     {         /// <summary>         /// element id         /// </summary>         [column("id")]         public int id { get; set; }          /// <summary>         /// name of dc         /// </summary>         [column("name")]         public string name { get; set; }          /// <summary>         /// dc description         /// </summary>         [column("description")]         public string description { get; set; }          /// <summary>         /// foreign key         /// </summary>         public virtual efsystemdatamodule module { get; set; }          /// <summary>         /// name of module         /// </summary>         [column("enabled")]         public string enabled { get; set; }     } } 

and

{     /// <summary>     /// entity framework systemdata.module database table object representation     /// </summary>     [table("systemdatamodule", schema = "mzmesdb")]     public class efsystemdatamodule     {         /// <summary>         /// element id         /// </summary>         [column("id")]         public int id { get; set; }          /// <summary>         /// name of module         /// </summary>         [column("name")]         public string name { get; set; }          /// <summary>         /// if module installed. char because oracle not support boolean         /// </summary>         [column("installed")]         public char installed { get; set; }          /// <summary>         /// if module enabled. char because oracle not support boolean         /// </summary>         [column("enabled")]         public char enabled { get; set; }      } } 

oracle tables has foreign key:

create table "mzmesdb"."dcdc" (                                  "id" integer not null ,                              "name" varchar2(64) not null ,                              "description" varchar(256),                             "module_id" integer not null,                             "module_name" varchar(64) not null,                             "enabled" char not null,                              primary key ("id") validate,                             foreign key (module_id, module_name) references systemdatamodule(id, name) 

no problems @ compilation, @ rutime when issue:

mzdbcontext dbcontext = new mzdbcontext();             efdcdc configureddc = new efdcdc();              try             {                 configureddc = dbcontext.efdcdc.firstordefault(item => item.name == "common_name");             }             catch (exception e)             {                 debug.writeline("error reading database. message: " + e.message.tostring());                 return false;             } 

i following error oracle ef driver:

ora-00904: \"extent1\"."\"module_id\":invalid identifier. 

i wanna check if dcdc element exists in database later take data processing. doing wrong ?

rds

this invalid column name. in oracle, in upper case column names. mixed case module_id coming from? see id used in code.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -