locked
Entity Framework Exception: Schema specified is not valid. for oracle RRS feed

  • Question

  • User-1868221531 posted

    I working in Asp.net with entity framework in vs 2010 with oracle database. I provide connection string from code for entity frame work datacontext. Here is my code:

    public static string getConStrSQL()
        {
    
            //string connectionString = new System.Data.EntityClient.EntityConnectionStringBuilder
            string connectionString = new System.Data.EntityClient.EntityConnectionStringBuilder
            {
                Metadata = "res://*",
                Provider = "Oracle.ManagedDataAccess.Client",
                //Provider = "Oracle.DataAccess.Client",
                ProviderConnectionString = new System.Data.SqlClient.SqlConnectionStringBuilder
                {
                    //InitialCatalog = "ORCL",
                    DataSource = "MONOJ-PC:1521/ORCL",
                    //IntegratedSecurity = false,
                    UserID = "C##MONOJ",                 // User ID such as "sa"
                    Password = "Thanks123",               // hide the password
                }.ConnectionString
            }.ConnectionString;
    
            return connectionString;
        }
    
        public List<CUSTOMER> GetCustomerList()
        {
    
            using (Entities db = new Entities())
            {
                db.Connection.ConnectionString = getConStrSQL();
                db.Connection.Open();
    
                var data = from p in db.CUSTOMERs
                           select p;
    
                db.Connection.Close();
    
                return data.ToList();
            }
        }

    But when i run the Code i get Following errors:

    Schema specified is not valid. Errors: error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered. DAL.DBModel.ssdl(2,46) : error 0172: All SSDL artifacts must target the same provider. The Provider 'Oracle.DataAccess.Client' is different from 'Oracle.DataAccess.Client' that was encountered earlier. DAL.DBModel.ssdl(2,89) : error 0169: All SSDL artifacts must target the same provider. The ProviderManifestToken '12.1' is different from '9.2' that was encountered earlier. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'Schema' is already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(834,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.Table' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(844,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.TableColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(870,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.View' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(882,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ViewColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(908,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.Function' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(933,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.Procedure' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(943,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.Parameter' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(967,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.Constraint' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(979,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.CheckConstraint' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(987,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ConstraintColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(996,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ForeignKeyConstraint' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1005,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ForeignKey' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1016,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ViewConstraint' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1031,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.TableTableConstraint' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1044,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ConstraintConstraintColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1057,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ConstraintForeignKey' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1070,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.FromForeignKeyColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1083,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ToForeignKeyColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1096,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.TableTableColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1109,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ViewViewColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1122,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.FunctionFunctionParameter' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1135,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ProcedureProcedureParameter' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1148,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ViewViewConstraint' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1161,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ViewConstraintConstraintColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1174,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ViewConstraintForeignKey' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1187,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.FromForeignKeyViewColumn' was already defined. Oracle.ManagedDataAccess.src.EntityFramework.Resources.EFOracleStoreSchemaDefinition.ssdl(1200,4) : error 0019: Each type name in a schema must be unique. Type name 'Oracle.ToForeignKeyViewColumn' was already defined.

    I googled but can not get any answer. Please, Help me. It's argent.

    Bye-

    With regards

    Sadequzzaman Monoj

    Bangladesh

    Friday, January 23, 2015 8:33 AM

All replies

  • User269602965 posted

    I put copy of the DLL for Oracle.ManagedDataAccess.Client and a copy of the correct TNSNAMES.ORA

    in the application /BIN direction and make local reference to the DLL.

    The DLL by default should look for the tnsnames.ora in the /BIN directory first.

    That eliminates problems with multiple versions possible in GAC, etc.

    Friday, January 23, 2015 11:28 AM