locked
LINQ to Entity & Application Deployment RRS feed

  • Question

  • User-1355132948 posted

    Dears

    I have an application that runs using LINQ to Entity and Oracle database server (which I'm not an admin on), I'm currently moving my application to production server but trying to test the new Prod Schema on my Dev application, my current schema name is QMIC so is my application, while the new schema is QUALITY_DAMMAM but all database objects are identical (Tables/views ..etc.) which I check using Toad.

    when I just updated my connection string to the new service naming I got the following error in my application,

    ORA-00942: table or view does not exist 

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: Oracle.ManagedDataAccess.Client.OracleException: ORA-00942: table or view does not exist
    
    Source Error: 
    
    
    Line 78:                 {
    Line 79:                     // Save Mode
    Line 80:                     if (context.USERS.Any(user => user.USER_ID.ToLower() == userID.ToLower()))
    Line 81:                     {
    Line 82:                         return true; 
    
    Source File: d:\In-House Applications\QMIC\Classes\DAL.cs    Line: 80 
    

    moreover, through debugging & testing I found out that my application does retrieve correct data from my new schema, but doesn't run the application.

    the question is am I missing some steps to do associated with LINQ to Entity, edmx model ? is there a best practice to changing a database of such application ?  

    Knowing that I'm new to LINQ to Entity.

    Monday, December 25, 2017 1:59 PM

Answers

  • User991499041 posted

    Hi Banan,

    When your application is running on the development machine, everything works fine, but on production server it fails, giving you the error "ORA-00942: table or view does not exist". Let's see a possible reason and a workaround to solve the problem.

    A possible reason and a workaround to solve the problem.

    Oracle error could come from the "<edmx:StorageModels>" section:

    <?xml version="1.0" encoding="utf-8"?>
    
      <edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx";>
    
        <!-- EF Runtime content -->
    
        <edmx:Runtime>
    
          <!-- SSDL content -->
    
          <edmx:StorageModels>
    
            <Schema Namespace="Model.Store" Alias="Self" Provider="Oracle.DataAccess.Client" ProviderManifestToken="10.2" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator"; xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl";>
    
              <EntityContainer Name="ModelStoreContainer">
    
                <EntitySet Name="YOUR_TABLE" EntityType="Model.Store.YOUR_TABLE" store:Type="Tables" Schema="YOUR_SCHEMA_DEVELOPMENT_MACHINE" /> ... ...

    The attribute of EntitySet we focus on is Schema (red highlighted). Suppose we have a development machine we are working on with the Oracle Schema "YOUR_SCHEMA_DEVELOPMENT_MACHINE". Everything, here, works fine, but if we deploy the project to the production server, the Oracle Schema could be different (e.g.: "YOUR_SCHEMA_PRODUCTION_SERVER").

    A workaround is the following:

    • Open the .edmx file with a text editor
    • Delete every occurrence of the following string: Schema="YOUR_SCHEMA_DEVELOPMENT_MACHINE"
    • Save the file
    • Recompile the Project

    Ref: http://library.logicsistemi.it/en/net/general-topics/50-asp-net-mvc-entity-framework-oracle-ora-00942-table-or-view-does-not-exist

    Regards,

    zxj

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 26, 2017 1:48 AM

All replies

  • User991499041 posted

    Hi Banan,

    When your application is running on the development machine, everything works fine, but on production server it fails, giving you the error "ORA-00942: table or view does not exist". Let's see a possible reason and a workaround to solve the problem.

    A possible reason and a workaround to solve the problem.

    Oracle error could come from the "<edmx:StorageModels>" section:

    <?xml version="1.0" encoding="utf-8"?>
    
      <edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx";>
    
        <!-- EF Runtime content -->
    
        <edmx:Runtime>
    
          <!-- SSDL content -->
    
          <edmx:StorageModels>
    
            <Schema Namespace="Model.Store" Alias="Self" Provider="Oracle.DataAccess.Client" ProviderManifestToken="10.2" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator"; xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl";>
    
              <EntityContainer Name="ModelStoreContainer">
    
                <EntitySet Name="YOUR_TABLE" EntityType="Model.Store.YOUR_TABLE" store:Type="Tables" Schema="YOUR_SCHEMA_DEVELOPMENT_MACHINE" /> ... ...

    The attribute of EntitySet we focus on is Schema (red highlighted). Suppose we have a development machine we are working on with the Oracle Schema "YOUR_SCHEMA_DEVELOPMENT_MACHINE". Everything, here, works fine, but if we deploy the project to the production server, the Oracle Schema could be different (e.g.: "YOUR_SCHEMA_PRODUCTION_SERVER").

    A workaround is the following:

    • Open the .edmx file with a text editor
    • Delete every occurrence of the following string: Schema="YOUR_SCHEMA_DEVELOPMENT_MACHINE"
    • Save the file
    • Recompile the Project

    Ref: http://library.logicsistemi.it/en/net/general-topics/50-asp-net-mvc-entity-framework-oracle-ora-00942-table-or-view-does-not-exist

    Regards,

    zxj

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 26, 2017 1:48 AM
  • User-1355132948 posted

    It's solved!

    MANY MANY THANKS ..

    Tuesday, December 26, 2017 9:58 AM