c# - Oracle DbContext .NET -


hi first post here. using dbcontext data oracle database. tell me please, doing wrong. no errors no data.

public class oraclecontext : dbcontext {     public oraclecontext()         : base("oracleconnection")     {      }      public dbset<role> roles { get; set; }     protected override void onmodelcreating(dbmodelbuilder modelbuilder)     {         modelbuilder.entity<role>().totable("roles");         modelbuilder.entity<role>().property(role => role.role_id).hascolumnname("role_id").hascolumntype("");         modelbuilder.entity<role>().property(role => role.user_role).hascolumnname("user_role").hascolumntype("varchar");         base.onmodelcreating(modelbuilder);     }   } public class role {     [key]     public int role_id { get; set; }     public string user_role { get; set; } } 

and controller:

        public actionresult index()     {         oraclecontext ctx = new oraclecontext();          viewbag.c = ctx.roles.count();         return view();     } 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -