c# - EntityFramework Code First Oracle -


i have follow context, mapping , class uses work oracle:

public class context : dbcontext     {         public string schema { get; set; }          public context(string connectionstring)             : base(connectionstring)         {         }          public dbset<user> userdbset { get; set; }          protected override void onmodelcreating(dbmodelbuilder modelbuilder)         {             modelbuilder.configurations.add(new usermapping(schema));         }     }      public class user     {         public decimal id { get; set; }         public string name { get; set; }         public string lastname { get; set; }     }      public class usermapping : entitytypeconfiguration<user>     {         public usermapping(string schema = "dbo")         {             haskey(t => t.id);             totable(schema + ".tbluser");              property(t => t.id).hascolumnname("id");             property(t => t.name).hascolumnname("name");             property(t => t.lastname).hascolumnname("lastname");         }     } 

but when call the:

var context = new context("name=oracle")             {                 schema = "usertablespacedefault"             };          var users = context.userdbset.tolist(); 

the oracle privider shows me follow error:

{"ora-00904: \"extent1\".\"id\": invalid identifier"}

and thats why entityframeworks try execute follow query:

select  "extent1"."id" "id",  "extent1"."name" "name",  "extent1"."lastname" "lastname" "usertablespacedefault"."tbluser" "extent1" 

any .dll necesary ??

here connectionstring:

<add name="oracle" connectionstring="data source=localhost:1521/xe;password=isolucion2015*;user id=system" providername="oracle.dataaccess.client" /> 

i faced same problem of upper case names , oracle there nuget package take care of that.

including entityframework.oraclehelpers , doing oneliner apply uppercase table, column , foreign key conventions.

  using entityframework.oraclehelpers;    protected override void onmodelcreating(dbmodelbuilder modelbuilder)   {         this.applyallconventionsiforacle(modelbuilder);   } 

more info , examples @ github page.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -