Mvc with oracle entity framework

Hi,
I am new to both MVC and Oracle EF...i have installed the necessary components (ODAC beta 3) and tried out the tutorial that oracle has put up and was able to successfully finish it...
Now i want to create a new MVC 3 app (based on MVC Movie tutorial available online) ...
I have a model generated from my oracle database..however when i add a controller in MVC, the controller does not seem to recognize my model..What do i need to do so that controller can recognize the model that i generated from oracle database..????
Is there an example out there that builds an asp.net MVC app using oracle entity framework??
Thanks.

Hello,
is a week that I document but I still have a bit of confusion.
Work on Oracle 11g with VS2010 I installed ODTwithODAC112030.
I have to make a data entry form after the registration of an account.
Can I create an application with MVC and EntityFramework then using Razor for pages CSHTML?.
WHAT HAVE I DONE:
1) Creating the Oracle schema QUESTIONARIO.
2) Execution of InstallAllOracleASPNETProviders.sql
3) Create application with MVC 3
4) Insert the web.config connection parameters
<connectionStrings>
    <add name="OraQuestConnString" connectionString="DATA SOURCE=...;....;USER ID=QUESTIONARIO;PASSWORD=*****" providerName="Oracle.DataAccess.Client" />
5) Insertion of the parameters in the web.config for the management of user profiles
<membership defaultProvider="OracleMembershipProvider">
<profile>
        <providers>
          <clear />
          <add name="OracleProfileProvider" type="Oracle.Web.Profile.OracleProfileProvider, Oracle.Web, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraQuestConnString" applicationName="questionario_casa_ufficio" />
        </ Providers>
      </ Profile>
      <roleManager enabled="true" defaultProvider="OracleRoleProvider"> .......
6) The application works and I registered users ORA_ASPNET_USERS etc..
7) I have created the table "Questionnaire" in the DB
8) I have created the Model of table "Questionnaire"
9) I created the corresponding Controller and the Views pages with Razor who created in the "Views/Questionnaire" directory all management pages (Index.cshtml - Create.cshtml - Edit.cshtml - Delete.cshtml)
10) when the application starts tells me I can not open the databasel SQL-Server, I suppose that it work only with SQL Server!! Or did I do something wrong?
11) Then I create the Model from DATABASE using "ADO. NET Entity Data Model"
12) But I did not understand if I can use the EDMX Model to create pages with Razor or with another tool.
13) Is there an automated way to create pages of data management starting from the Model EMDX or do I have to create them all manually?
Please help me.
Thank you very much

Similar Messages

  • Help with Oracle Entity Framework and synonyms

    Hi.
    I have some troubles using schemas and synonyms of tables. It means that we are working with diferent schemas, one of those is the owner of tables and other one use synonyms with permissions to access, modify and delete in these tables, this one is the schema that the application use. So whats the way to use this synonyms to tables using the application schema with Entity Framework?
    While I'm using the application data schema I couldn't get data from tables, because the application schema doesn't have tables just use synonyms to them.
    Thanks in advanced
    Cesar.

    I have the same problem. I have created a data connection in the VS2010 server explorer to my oracle database. In the filter I have added the schemas that my user id has access to and the tables are shown in the server explorer. However, when I go through the ADO.NET entity wizard, the tables are not shown.

  • Deploying LightSwitch applications to IIS using the Oracle Entity Framework

    I have had no sucess running Lightswitch applications on IIS using the Oracle Beta entity framework. Applications work fine from visual studio but after deployment fail when I trying to access an Oracle data entity.
    I have tried deploying to a 2008 V2 server 64Bit running IIS7.5 and also to a 32 bit windows 7 machine running IIS7. Both machines had the entity framework installed and I could connect to Oracle with SQL developer just fine. Briefly in the case of the 64 bit machine I get a bad image exception indicating a 64/32 bit conflict. (App pool switched to allow 32bit). The problem with the 32Bit machine is that the session either hangs or dies with an [Arg_TargetInvocationException]
    In all tests apps could connect to SQL server fine but as soon as I use an Oracle connection they fail. It would very helpfull if someone could confirm that they have managed to use the Entity framework Beta with Lightswitch and IIS.
    Thanks in advance
    Edited by: user12218662 on 08-Oct-2011 11:35
    Edited by: user12218662 on 08-Oct-2011 11:37

    Both hosts working now. Initially I created a service account for the aspnet service with extended rights and assigned this to the application pool. This subsequentluy turned out not to be required - ApplicationPoolIdentity works fine. What worked was as follows:
    1. On a 64 Bit host you need to set the application pool to Enable 32 Bit Applications (Right click the relevant app pool in IIS and select advanced)
    2. Switch off windows authentication for the application (leaving just anonoymous authentication) This was required on both hosts
    3. On the 32 Bit host copy tnsnames to the oracle client admin folder - the framework seems to ignore theTNS_ADMIN environment variable. Probably more to this but its working for now.

  • Seeding multiple databases with single Entity Framework context

    I am developing a single-instance, multi-tenant web application, with a SQL database using Entity Framework 6 Code-First. 
    I want to have a separate database for each client, generated from the same EF models, with a single DbContext. The database to connect to will be determined by the subdomain that the client is using the web app from. 
    This seems to work fine and the correct database is connected to depending on the subdomain. However my issue is seeding the databases with data. This is the code I have:
    foreach (var connString in ConfigurationManager.ConnectionStrings.Cast<ConnectionStringSettings>()))
    Configuration.PerformDatabaseMigration(connString.Name);
    This then calls the PerformDatabaseMigration method: 
    public class Configuration : DbMigrationsConfiguration<DataContext>
    public Configuration()
    AutomaticMigrationsEnabled = false;
    AutomaticMigrationDataLossAllowed = false;
    public static void PerformDatabaseMigration(string connStringName)
    var databaseInitialiser = new Configuration { TargetDatabase = new DbConnectionInfo(connStringName) };
    var dbMigrator = new DbMigrator(databaseInitialiser);
    dbMigrator.Update();
    protected override void Seed(DataContext context)
    base.Seed(context);
    var superAdmin = new User { Id = 1, UserName = "SuperAdmin" };
    context.Users.AddOrUpdate(superAdmin);
    The issue is that when seeding this data for the second database, the context passed into the Seed method already has the admin user added to the `DbSet<User>` property of the context, even though the context is for the second databse connection, not
    the first. It appears that the context is not being cleared from seeding the first database, and so I receive a `DbUpdateException`, as my User.Username field is a unique index.
    Cannot insert duplicate key row in object 'dbo.Users' with unique index 'IX_UserName'. The duplicate key value is (SuperAdmin).\r\nThe statement has been terminated.
    public class User : ModelBase, IUserIdentity, IPrincipal, IIdentity 
        [Index(IsUnique = true)]     
      [Required]     
      [StringLength(40)]       
    public string UserName { get; set; }

    Hello Attune,
    >>This seems to work fine and the correct database is connected to depending on the subdomain. However my issue is seeding the databases with data.
    Is that you firstly create these databases and then call the PerformDatabaseMigration method to seed these database with data? Do you have a try to seed these database data when creating the database with AutomaticMigrationsEnabled = true; with your provided
    configuration class, I tested it and it could work as seeding same data to different database:
    internal sealed class Configuration : DbMigrationsConfiguration<CFs.CFContext>
    public Configuration()
    AutomaticMigrationsEnabled = true;
    public static void PerformDatabaseMigration(string connStringName)
    var databaseInitialiser = new Configuration { TargetDatabase = new DbConnectionInfo(connStringName) };
    var dbMigrator = new DbMigrator(databaseInitialiser);
    dbMigrator.Update();
    protected override void Seed(CFs.CFContext context)
    base.Seed(context);
    var superAdmin = new ApplicationUser() { ApplicationUserID = 1, FirstName = "", LastName = "" };
    context.ApplicationUsers.AddOrUpdate(superAdmin);
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • MVC 4 Using Entity Framework How to save Images in Database

    Iam Beginner to
    MVC 4 ... I want to Upload Image from my form and save to the SQL Database by Using Entity Framework . I have searched alot but couldnt succeed yet,,

    http://forums.asp.net/
    You should post to the MVC section of above forum first.

  • Oracle Entity Framework: some tables won't update the entity data model

    I've successfully connected to an oracle database, and I've set up an entity data model project in Visual Studio 2010.
    Using "Update Model from Database" on the EDMX file, some tables that I select are imported, but others do not appear. Is there something about these tables that prevents them from being imported?
    Thanks
    Jonathan Poor
    Rubin & Poor, Inc.

    When I tried this the first time, I missed a message that answers my question:
    The table/view does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it.
    Another table was brought in because the entity model managed to infer a primary key:
    The table/view does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.

  • Cannot insert null into a Primary Key Column using Entity Framework

    I have to insert data into UserPreferences Table which has a primary key. This I am doing with Oracle Entity Framework Provider.
    It is unable to do it though i have set the StoreGeneratedPattern = "Identity". But while saving changes it is saying a null error is being inserted into the primary key.

    I exported the same package to BIDS and ran it but still unable to get the issue. It is running fine.
    Also then same package is running fine in other environments.
    Thanks
    Thats strange
    Are you pointing to same databases itself while executing from server?
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Installing ODAC Entity Framework with oracle express

    Hi, I need to develop a .net web app with oracle back end. To setup development env. for oracle I downloaded oracle database express edition 11g 2. and installed it succesfully. after I tried to install this ODAC it throws me a error
    "Remove all the spaces from the chosen ORACLE_HOME" help me out to resolve this,
    Can I use SQL Developer to connect to Oracle Express. Kindly help me out asap.

    Hello,
    This is by designed in Entity Framework, the view is not designed to be editable by default. If you persist in editing a view, you need to create an editable view, for details, please check this blog:
    How to create an updateable view with ADO Entity Framework and with LINQ to SQL
    This blog is based on the SQL Server database, however, I notice that you are working with the Oracle database, I am not sure if the Oracle database provider for Entity Framework supports the editable view, I
     suggest you could confirm this on the Oracle database forum:
    https://community.oracle.com/welcome
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Oracle XE 11g and Entity Framework 4.4

    I have Windows Server 2008 R2 32bit and Oracle 11g Release 2 Express Edition installed on my server machine.
    I have Windows 7 Pro 64bit, Visual Studio 2010 SP1 32bit, .NET 4.0 and Oracle .NET Data Provider (ODTwithODAC1120320_32bit) installed on my development machine.
    The data provider download mentioned Entity Framework support. Existing tutorials on how to use Oracle with the Entity Framework makes me believe that EF is indeed supported! But when I try to create a new ADO.NET Entity Model, the Oracle data provider nor data source isn't listed!
    Image: http://i.stack.imgur.com/4SnW8.png
    On the other hand, if I want to create a new database connection, via the Server Explorer view, there are no problems connection to Oracle's DB.
    Image: http://i.stack.imgur.com/ipXSV.png
    The reason I need Entity Framework support is because we're migrating from MSSQL to Oracle and are looking for the most painless route to do so.
    Edited by: 916761 on Dec 4, 2012 3:24 AM

    I had to create a New Connection, when the dropdown menu didn't contain it.

  • Want to use the Entity Framework for Oracle

    Currently our web applications are installed on Windows 2003 Server, IIS 6.0. Yes, this seems like the dark ages...years behind. They have an older version of the Oracle Client on the machine (11.0.1). This version does not support Oracle.DataAccess 4.x. .NET Framework 4.0 is installed on the Windows 2003 server. This version also does not support the Entity Framework.
    However, my development environment does not have any Oracle Client installed. I am just using the latest version of ODAC/ODP.NET with Visual Studio 2010. I am able to create apps locally with the Entity Framework but unfortunately cannot get them to work on the server because there of the older Oracle Client on that machine. Also there are approx. 50 applications on that server that are accessing this old version of OracleDataAccess 2.116.0 with references hard coded in the web.config. What's the best practice for dealing with legacy applications that are accessing older versions of Oracle?
    In short, what do I need to do in order to upgrade to the version of Oracle that will support the Entity Framework while still supporting legacy apps? Do I go for an Oracle Client upgrade or I just merely get the latest version of ODAC/ODP.NET installed on that server?
    Thanks!
    Edited by: imterpsfan2 on Mar 7, 2013 12:01 PM

    imterpsfan2 wrote:
    What I would probably like to do is somehow set the dll directory to my local bin directory and just put all the .dlls for the most recent ODP.NET in my app and leave the existing applications as they are until I can migrate them.
    I've seen examples of this but doesn't seem to work for me.You can do that by having both Oracle clients installed, and using the DLLPath configuration option to force the applications to use the one you want.
    That said, the next version of the managed client is going to support working in Entity Framework, and that is just an assembly you can include in the project with no Oracle installation at all. So really, the best answer is going to be to use that once they release it.
    (Also - most of the time something compiled for Oracle 11.x will work in 11.2.0.3 without doing anything. The 11.2.0.3 installer adds binding redirects to itself from older versions, provided you were loading from the GAC.)

  • Custom mapping is obviously not reflected in the Entity Framework designer

    Hi,
    I use the Oracle Data Provider for .NET 11.2.0.2.50 Beta 3 with the Entity Framework. I added a custom mapping to the app.config that maps NUMBER(1,0) to bool:
    <oracle.dataaccess.client>
    <settings>
    <add name="bool" value="edmmapping number(1,0)" />
    </settings>
    </oracle.dataaccess.client>
    When I create an Entity Framework model from my Oracle database the EF designer uses Int16 for NUMBER(1,0) fields instead of bool. If I run the program I then get an exception (as expected):
    "Schema specified is not valid. Errors:
    EntityFrameworkTest.msl(7,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.Int16[Nullable=True,DefaultValue=]' of member 'ISVIPCUSTOMER' in type 'EntityFrameworkTestModel.CUSTOMER' is not compatible with 'OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=1,Scale=0]' of member 'ISVIPCUSTOMER' in type 'EntityFrameworkTestModel.Store.CUSTOMERS'."
    Okay. Assuming it's an error in the EF designer, I set the type Boolean in the model myself for the NUMBER(1,0) fields. But that gives me a compilation error:
    "Error 2019: Member Mapping specified is not valid. The type 'Edm.Boolean[Nullable=True,DefaultValue=]' of member 'ISVIPCUSTOMER' in type 'EntityFrameworkTestModel.CUSTOMER' is not compatible with 'OracleEFProvider.number[Nullable=True,DefaultValue=,Precision=1,Scale=0]' of member 'ISVIPCUSTOMER' in type 'EntityFrameworkTestModel.Store.CUSTOMERS'."
    Is this a bug in the provider? Or am I missing something?

    Are you using model first or database first? If you're using database first, make sure you update the model from the database after adding that configuration.
    Also, if your model is in a different assembly (ie a different project) from your executable, your executable project's configuration file also needs the mapping section.
    Finally... there's been a LOT of threads about this not working properly in beta 3. I'm still on beta 2 and except for some incorrect error messages in the designer it works fine (I get fake errors). If nothing else works, I might suggest trying beta 2 as a last resort.

  • Update the database structure from entity Framework Model

    Hello !
    I'm using VB.net , EF6 with SQL server 2008R2 database.
    This is the situation :
    I have created the application. Using wizard I have created the Entity model from an existing database.
    A client start using this application using this database on his computer.
    After some month , I made some modifications on the database and I have updated the model on my application .
    Now I have a new .exe file that has the new model from the new database.
    I put the new .exe file on the client computer.
    Now on his computer : The .exe file has the new database model , but the sql server database has the old structure.
    I want to know : Is possible to update the database structure from the entity model on application ?
    I want to add a command on application that can make ( if is possible ) this update , so the database become up to date according to entity model ?
    Thank you !

    Hello,
    From your description, it seems that you want to apply a migration for a database first approach, unfortunately, as far as I know, EF Migrations is a product targeted at Code First and doesn't support Database First operations. A workaround I know is to
    use update-scripts. If your database structure would be changed frequently, it is recommended to use the Code First approach which would have a better workaround for migrations, for details, you could refer to this
    video,
     and with the
    Entity Framework Power Tools, it is easy to create a code first based project form an existing database.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Calling Oracle stored procedure with out param of user define type from Entity Framework 5 with code first

    Guys i am using Entity Framework 5 code first (I am not using edmx) with Oracle and all works good, Now i am trying to get data from stored procedure which is under package but stored procedure have out param which is user define type, Now my question is
    how i will call stored procedure from entity framework
    Thanks in advance.

    I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
    If you think you are going to get existing MS Stored Procedures  or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
    coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
    You could use the EF backdoor, call Oracle Command object and use the Packages,  if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
    That's about your best shot.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx

  • Error when make controller with MVC entity framework

    error when make MVC with entity framework, WHY??

    Hi Arif Kalbu,
    It would be better if you could share us the detailed error message, so I could provide useful informaiton or provide the correct forum for this issue, you know that this forum is to discuss the VS IDE.
    But if the real issue is related to the MVC project, maybe the ASP.net forum would be better: http://forums.asp.net. If then, you could get an answer more quickly and professional. Thanks for your cooperation.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Sorting is wrong with Entity Framework for oracle

    Hi,
    I've downloaded the Entity Framework for Oracle beta and I found a bug. It's easy to repro:
    - Create a model with a simple table
    - Create a dynamic data web app
    - display the content of your table and try to sort
    -> the sql generated is wrong and only sorts on the currently displayed rows and not the entire data.
    Did anyone else notice that?
    Edited by: lnu on 14 févr. 2011 05:51

    Before ODP.NET beta with EF was available I was working with OracleEFProvider from CodePlex (sample alpha version but works with VS2010).
    I found the same issue there. Since I had a source code I managed to find the solution.
    In class which implemented the base class DbExpressionVisitor there was a method: public override ISqlFragment Visit(DbSkipExpression e)
    I had to add sort clause AFTER visiting the expression (which was done too early in previous code).
    As the main idea of DbExpressionVisitor should be the same in case of Oracle provider, this can be the reason of improper sorting in queries with paging.

Maybe you are looking for