VS2010, Entity Framework, and TNS Less connection strings

I am playing around with the Oracle 11g ODP.NET stuff and the Visual Studio 2010 integration. I am trying to create and entity data model, but I am connecting to a RAC cluster with a TNS Less connection string (Example at bottom). Previously I've had to use Oracle's OLE DB drivers to connect, however I would love to be able to leverage the Entity Framework in my next project. When I go to create a new connection in my VS project, the Connection Properties dialog pops up with option to choose the Data Source. I choose Oracle, but then I don't see a way to connect in the way that I have to. Any help would be appreciated. Thank you.
Connection String Example:
Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = someHost.prod.someDomain.net)(PORT = 9991)) (ADDRESS = (PROTOCOL = TCP)(HOST = someHost2.prod.someDomain.net)(PORT = 9991)) (ADDRESS = (PROTOCOL = TCP)(HOST = someHost3.prod.someDomain.net)(PORT = 9991)) (ADDRESS = (PROTOCOL = TCP)(HOST = someHost4.prod.someDomain.net)(PORT = 9991)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = myService.myDomain.com)));User Id=myUser;Password=myPassword;

Hello cshay, you're right, I had the wrong version installed. I'm sure I selected the beta first, but I suppose I downloaded the stable version after creating my Oracle account.
Thanks cshay, and sorry to bother you all with such a question!

Similar Messages

  • DNS Less Connection String

    Hi everyone, I'd like to ask if I could connect to the Database using a DNS Less Connection String. How can I do so? Please tell me the connection string.
    Thanks lotz
    Antony

    What do you mean by a 'DNS Less Connection String'?
    You can use an IP address instead of a hostname, if that is what you mean.
    Yours,
    Laurenz Albe

  • 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.

  • TNS Less Connection

    *For some reason on my production server I can not get a connection to the database using TNSnames --*
    TNSping Works and the TNSNAMES.ORA is correct.
    And it works fine on my test server.
    So I hard coded the server IP in the connection string
    <connectionStrings>
              <add name="ORAConnectionString" connectionString="Data Source=XXX.XXX.XXX.XXX:1521;User ID=MyUser;Password=MyPassword;" providerName="Oracle.DataAccess.Client"/>
    </connectionStrings>
    But my boss hates it because I'm not using TNSNAMES proper..
    <connectionStrings>
    <add name="ORAConnectionString" connectionString="Data Source=MyTNSnames;User ID=MyUser;Password=MyPassword;" providerName="System.Data.OracleClient"/>
    </connectionStrings>
    Does anybody know how to resolve this issue?  Is there a way to point the TNSNAMES.ORA file from within the CoonectionString

    Use the fancy new app/web.config method using 12c fully managed provider. It's very nice:
    EDIT: forgot to add this.. it has to be right after <configuration> on line 2
    <configSections>
        <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess" />
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
      </configSections>
      <oracle.manageddataaccess.client>
        <version number="*">
          <settings>
            <setting name="TraceLevel" value="0" />
            <setting name="TraceOption" value="0" />
            <setting name="TraceFileLocation" value=".\logs" />
          </settings>
          <dataSources>
            <dataSource alias="orcldb1.blahblah.com" descriptor="(DESCRIPTION=(ADDRESS_LIST=(FAILOVER=on)(ADDRESS=(PROTOCOL=TCP)(HOST=host1.blahblah.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=host2.blahblah.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=host3.blahblah.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=host4.blahblah.com)(PORT=1521)))(CONNECT_DATA=(FAILOVER_MODE=(TYPE=select)(METHOD=basic)(DELAY=50))(SERVER=default)(SERVICE_NAME=MY_AWESOME_SERVICE)))"/>    
          </dataSources>
        </version>
      </oracle.manageddataaccess.client>
    <connectionStrings>
        <add name="MyOracleDBString" connectionString="user id=oracleuser;password=secret;data source=orcldb1.blahblah.com"/>
    </connectionStrings>
    And you can of course encrypt the connectionStrings part which has your credentials, while still knowing what your "TNS" looks like. Managed provider checks this before looking for existing TNS files.
    The new Managed provider in 12c is like discovering the wheel for us .NET folks.

  • Install ODAC (11.2.0.2.30) Entity Framework and LINQ to Entities Failed

    Hi
    I am trying to install ODAC for Entity Framework & Link.
    But, while installing, there showed a message *"OS error, the Oracle MTS Recovery Service can't be started"*,
    and there were three choices, *"Ignore, Cancel, Retry"*.
    If I choose *"Cancel"*, the installing will be stopped, and if I choose 'Retry', it will always try to restart the MTS service, but in vain.
    If I choose *"Ignore"*, the setup will go on, but the MTS service can't be started as usual, and shows a message *"Function error"*.
    Is there anyway to fix the problem, so I can successfully install ODAC on my pc?
    Oh,BTW, I have installed the Oracle 10g and Oracle Developer 6i on my pc for other reasons, and I can't remove them.
    Will it be the reason cause the ODAC installation failure?
    Environment :
    OS: Win XP Pro 32bit
    Framework : .net 4.0
    Visual Studio 2010
    Oracle 10g
    Oracle Developer 6i

    I haven't seen a download link for 11.2.0.2.*+40+* yet. If that's the new beta version, it hasn't been released yet. We're still on beta 1 (11.2.0.2.30).
    Trust me, a lot of people are looking forward to it. :)

  • Problem Entity framework and short types

    I am using the Entity Framework in Visual Studio to access a table in my oracle database. Problem is when selecting a record in runtime the following error shows up:
    Value was either too large or too small for an Int16
    This error originates when trying to access a table-field declared as number(5). The framework translates this in a short field. The max value for short is 32767, but the value in the table is 36001.
    Can I solve this?
    thanks.

    Yes, you need to change the mapping for that type to an int32. To do that you can add this to your configuration file:
    <oracle.dataaccess.client>
    <settings>
    <add name="int16" value="edmmapping number(4,0)" />
    <add name="int32" value="edmmapping number(9,0)" />
    </settings>
    </oracle.dataaccess.client>
    You should then update the model to get the new changes. Note that I've found that I have to change the types manually in the model, but after I do that once it works fine. Documentation is here: http://docs.oracle.com/cd/E11882_01/win.112/e18754/featLINQ.htm

  • Deployment from 11g to 10g connection string cannot get provider error.

    Hi, I'm doing a deployment from oracle client 11g to 10g. Is this possible? there are yes and no answer I have try out from the forum. All did not workout with any of the configuration setup.
    For development I am using VS2012, MVC 4. EF 4. Oracle 11g
    The server is currently running Oracle 10g with Oracle.Dataaccess.dll 10.2.0.100
    This is my connection string setup at the server.
    <?xml version="1.0"?>
    <!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=169433
    -->
    <configuration>
    <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </configSections>
    <connectionStrings>
    <add name="OraAspNetConnectionString" connectionString="Data Source=dtsr;User Id=ids;Password=pwd;" providerName="Oracle.DataAccess.Client"/>
    <add name="OraAspNetConnectionString2" connectionString="Data Source=dtsr;User Id=ids;Password=pwd;" providerName="Oracle.DataAccess.Client.OracleConnection"/>
    </connectionStrings>
    <!--<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>-->
    <appSettings>
    <add key="webpages:Version" value="2.0.0.0"/>
    <add key="webpages:Enabled" value="false"/>
    <add key="PreserveLoginUrl" value="true"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    </appSettings>
    <system.data>
    <DbProviderFactories>
         <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory,Oracle.DataAccess,Version=4.112.3.0,Culture=neutral,PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
    </system.data>
    <system.web>
    <compilation targetFramework="4.0">
    <assemblies>
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </assemblies>
    </compilation>
    <httpRuntime/>
    <authentication mode="Windows"/>
    <identity impersonate="true"/>
    <pages controlRenderingCompatibilityVersion="4.0">
    <namespaces>
    <add namespace="System.Web.Helpers"/>
    <add namespace="System.Web.Mvc"/>
    <add namespace="System.Web.Mvc.Ajax"/>
    <add namespace="System.Web.Mvc.Html"/>
    <add namespace="System.Web.Optimization"/>
    <add namespace="System.Web.Routing"/>
    <add namespace="System.Web.WebPages"/>
    </namespaces>
    </pages>
    <sessionState mode="InProc" timeout="20" cookieless="false"/>
    </system.web>
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
    <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/>
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/>
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
    </handlers>
    <security>
    <authorization>
    <add accessType="Allow" users="?"/>
    </authorization>
    </security>
    </system.webServer>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
    </dependentAssembly>
    <!--<dependentAssembly>
    <assemblyIdentity name="Oracle.DataAccess, Version=10.2.0.100, Culture=Neutral," publicKeyToken="89b483f429c47342" />
    <bindingRedirect oldVersion="10.2.0.100" newVersion="4.112.3.0"/>
              <publisherPolicy apply="no" />
    </dependentAssembly>-->
    </assemblyBinding>
    </runtime>
    <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
    </entityFramework>
    </configuration>
    I get this error when page trying to connect to database.
    [ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
    System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +163
    System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +39
    System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +46
    System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +62
    System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +117
    System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +453
    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +56
    System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
    System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37
    I have check the
    1. Enviroment Variables path is set to the 10.../client_1/
    2. Tnsname.ora already configured.
    3. machine.config did not define the connection string path, as it is define in the web.config
    4. Oracle.Dataaccess.dll is in the bin of my application website (v4.112.3.0).
    5. In my application web bin folder also include additional dlll.
    mfc71.dll
    msvcr71.dll
    oci.dll
    ociw32.dll
    orannzsbb11.dll
    oraocci11.dll
    oraociicus11.dll
    OraOps11w.dll
    Anyone please help.. Thanks in advance..
    Edited by: 976886 on Dec 13, 2012 7:46 PM

    976886 wrote:
    I want to know, it is possible to migrate the application from oracle 11g to 10g? such that the component are supported across?
    Because in the development, all goes well, no error on the oracle connection.
    OR did I miss out anything that causes it not working on my server deployment?yes
    yes
    yes
    how can we reproduce what you claim?

  • Entity Framework 6 and Odata v4

    I have built a simple WebAPI 2.2 project, using Entity Framework 6 and OData v4. I have a SQL server database that exists and would like to build an OData service for read-only reporting purposes. the database is a simple
    two table database in test that represents a possible development effort. The primary key on the Primary table is the configid (auto increment). The Primary key on the secondary table is the combination of the configid (link to primary), and the date descending.
    There is typically one update of the data per day and I need the most recent first.
    Running the project I can do all that you would expect. I can query the configs "/odata/configs". I can query a single entity "/odata/configs(1)", and I can query the detail "odata/configs(1)/detail". When I do this I get all
    x-thousand records for the last several years... most recent first... Great! My final effort in this project is to page the data at the client... I test the uri by using the following: "odata/configs(1)/detail?top=10". This results in 10 elements,
    however it is actually the bottom of the table data... not the sort order of the key in the sql table... can someone explain how I would go about fixing this particular issue?
    The goal is to use this service to produce a client that would visualize data changes over time. Paging would need to occur as you would typically expect. The client expects typical uri syntax, i.e. top, skip... in order to page the data. however the sort
    order is throwing the paging... Is there documentation on how to alter Entity Framework and Odata 4 queries to produce custom results? I am in the early stages of discovery on these technologies, but I anticipate more customization...
    I recall reading somewhere that Entity Framework requires a unique id on every table... is this true, and would that solve the problem? Altering the database in test would be easy enough... in practice however, not so much! Options?
    Primary Table:
    configid: int [primary key]
    name: string
    Secondary Table:
    configid: int (link to primary)
    date: datetime
    data: varchar(200)
    I created a new Web API 2.2 project and added the Entity Frameworks 6.1.2 and Odata 4.x. 

    Hello Stewart,
    According to your description, it seems that your issue is more related the Odata RestAPI, I suggest you could post it to the WebAPI forum:
    http://forums.asp.net/1246.aspx/1?Web+API
    And for paging querying in WebAPI, there is a blog I think which might be helpful:
    http://blogs.msdn.com/b/youssefm/archive/2013/02/19/paging-with-asp-net-web-api-odata.aspx
    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.

  • Entity framework TPT does not work - showstopper

    Greetings,
    I'm experiencing a similar problem that is described here:
    [Entity Framework and inheritance - Possible bug in EF?|http://stackoverflow.com/questions/11506683/entity-framework-and-inheritance-possible-bug-in-ef.]
    I'm using:
    Windows 7 64 bit
    ODAC 11.2 Release 5 32 bit
    Oracle Express 11.2 on localhost
    Visual Studio 2012
    Entity framework 5.0
    .net 4.5
    Create a simple database with TPT inheritance:
    CREATE TABLE Person(
    Id NUMBER(38, 0) NOT NULL,
    Name VARCHAR2(50),
    CONSTRAINT PK100 PRIMARY KEY (Id)
    CREATE TABLE Employee(
    Id NUMBER(38, 0) NOT NULL,
    JobTitle VARCHAR2(50),
    CONSTRAINT PK101 PRIMARY KEY (Id)
    ALTER TABLE Employee ADD CONSTRAINT ref_Employee_person
    FOREIGN KEY (Id)
    REFERENCES Person(Id)
    CREATE TABLE Superhero(
    Id NUMBER(38, 0) NOT NULL,
    Superpower VARCHAR2(50),
    CONSTRAINT PK102 PRIMARY KEY (Id)
    ALTER TABLE Superhero ADD CONSTRAINT ref_Superhero_person
    FOREIGN KEY (Id)
    REFERENCES Person(Id)
    -- Sequence
    CREATE SEQUENCE seq_id
    INCREMENT BY 1
    START WITH 55
    MINVALUE 1
    MAXVALUE 9999999999999999999999999999
    NOCYCLE
    NOORDER
    CACHE 20
    CREATE OR REPLACE TRIGGER PERSON_BI BEFORE INSERT ON PERSON FOR EACH ROW
    BEGIN IF :NEW.ID IS NULL THEN SELECT SEQ_ID.NEXTVAL INTO :NEW.ID FROM DUAL; END IF; END;
    Create a console application, add an edmx file, set up inheritance like so:
    Diagram
    And I set the Id property in Person entity as StoreGeneratedPattern to Identity
    Then I created the following program:
    static void Main(string[] args)
    //Employee
    var db = new Entities();
    EMPLOYEE e = new EMPLOYEE() { ID = 0, JOBTITLE = "Programmer"};
    e.NAME = "John Regular Doe";
    db.People.Add(e);
    //Superhero
    SUPERHERO s = new SUPERHERO();
    s.NAME = "Superman";
    s.SUPERPOWER = "Flight";
    db.People.Add(s);
    db.SaveChanges();
    //Fetch all persons and look at the type
    //this is where I get an error:
    var allPeople = db.People.ToList();
    allPeople.ForEach(x => Console.WriteLine("type: " + x.GetType()));
    This throws the following error when I fetch into allPeople:
    All objects in the EntitySet 'Entities.People' must have unique primary keys. However, an instance of type 'TestingTPTInheritance.EMPLOYEE' and an instance of type 'TestingTPTInheritance.SUPERHERO' both have the same primary key value, 'EntitySet=People;ID=38'.
    Looking at the database everything looks fine
    -- Person table --
    ID     NAME
    39     John Regular Doe
    40     Superman
    -- Employee table --
    ID     JOBTITLE
    39     Programmer
    -- Superhero table --
    ID     SUPERPOWER
    40     Flight
    If I take the select that EF generates in " db.People.ToList();" and run it I get the following result:
    C1      C2     NAME      C3      C4
    0X0X     40     Superman           
    0X0X     39     John Regular Doe     Programmer     
    Is this a bug in ODAC. If so is there a workaround or will there be a fix soon?
    Edited by: Amplus on 7.11.2012 07:59

    Thank you for the reply shsu
    I was being careless when I copied the error message and sequence, sorry about that. I did run this serveral times after I copied the error message. I recreate the seqence starting with 1 and recreated the problem. The error message is:
    All objects in the EntitySet 'Entities.People' must have unique primary keys. However, an instance of type 'TestingTPTInheritance.EMPLOYEE' and an instance of type 'TestingTPTInheritance.SUPERHERO' both have the same primary key value, 'EntitySet=People;ID=2'.
    The data in the tables is:
    Person:
    ID     NAME
    1      John Regular Doe
    2      Superman
    employee
    ID     JOBTITLE
    1      Programmer
    Superhero
    ID     SUPERPOWER
    2      Flight
    And the generated select is:
    SELECT
    CASE WHEN (( NOT (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL))) AND ( NOT (("Project2"."C2" = 1) AND ("Project2"."C2" IS NOT NULL)))) THEN '0X' WHEN (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL)) THEN '0X0X' ELSE '0X1X' END AS "C1",
    CAST( "Extent1"."ID" AS number(19,0)) AS "C2",
    "Extent1"."NAME" AS "NAME",
    CASE WHEN (( NOT (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL))) AND ( NOT (("Project2"."C2" = 1) AND ("Project2"."C2" IS NOT NULL)))) THEN NULL WHEN (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL)) THEN "Project1"."JOBTITLE" END AS "C3",
    CASE WHEN (( NOT (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL))) AND ( NOT (("Project2"."C2" = 1) AND ("Project2"."C2" IS NOT NULL)))) THEN NULL WHEN (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL)) THEN NULL ELSE "Project2"."SUPERPOWER" END AS "C4"
    FROM "TPT"."PERSON" "Extent1"
    LEFT OUTER JOIN (SELECT
    "Extent2"."JOBTITLE" AS "JOBTITLE",
    CAST( "Extent2"."ID" AS number(19,0)) AS "C1",
    1 AS "C2"
    FROM "TPT"."EMPLOYEE" "Extent2" ) "Project1" ON ( CAST( "Extent1"."ID" AS number(19,0))) = "Project1"."C1"
    LEFT OUTER JOIN (SELECT
    "Extent3"."SUPERPOWER" AS "SUPERPOWER",
    CAST( "Extent3"."ID" AS number(19,0)) AS "C1",
    1 AS "C2"
    FROM "TPT"."SUPERHERO" "Extent3" ) "Project2" ON ( CAST( "Extent1"."ID" AS number(19,0))) = "Project2"."C1"
    With the following result:
    C1      C2     NAME      C3      C4
    0X0X     2      Superman      null      null --> should't there be a "Flight" entry here??
    0X0X     1      John Regular Doe     Programmer     null
    I also tried this:
    var result1 = db.People.OfType<SUPERHERO>().ToList(); //Count=1
    var result2 = db.People.OfType<EMPLOYEE>().ToList(); //Count=1
    var result3 = db.People.OfType<PERSON>().ToList(); //Throws the following error:
    All objects in the EntitySet 'Entities.People' must have unique primary keys. However, an instance of type 'TestingTPTInheritance.EMPLOYEE' and an instance of type 'TestingTPTInheritance.SUPERHERO' both have the same primary key value, 'EntitySet=People;ID=2'.
    The only thing I can think of is that my little console app is picking up the oracle client from oracle express instead of the ODAC driver. Is there an easy way to force it to use the correct driver? I have this in my config file but I'm not sure if it works:
    <oracle.dataaccess.client>
    <settings>
    <add name="DllPath" value="C:\oracle\product\11.2.0\client_3\bin" />
    </settings>
    </oracle.dataaccess.client>
    And I have also referenced Oracle.Data.Access here:
    C:\oracle\product\11.2.0\client_3\odp.net\bin\4\Oracle.DataAccess.dll
    client_3 directory is my ODAC Release 5 installation. I changed the config settings to:
    <oracle.dataaccess.client>
    <settings>
    <add name="DllPath" value="C:\oracle\product\11.2.0\client_3\odp.net\bin\4\Oracle.DataAccess.dll" />
    </settings>
    </oracle.dataaccess.client>
    then the program was able to run this line:
    var allPeople = db.People.ToList();
    But both objects were of type EMPLOYEE. Then I ran this:
    var result1 = db.People.OfType<SUPERHERO>().ToList();
    and get the following error:
    All objects in the EntitySet 'Entities.People' must have unique primary keys. However, an instance of type 'TestingTPTInheritance.EMPLOYEE' and an instance of type 'TestingTPTInheritance.SUPERHERO' both have the same primary key value, 'EntitySet=People;ID=2'.
    The problem must be that I do have multiple versions of Oracle client installed on my computer and it is picking up the wrong one either when I'm generating the edmx file or when the application is connecting to the db. I think my next step will be to uninstall all oracle client instances as well as oracle express and try again from scratch!!

  • Self Reference Model Class - How to populate using Entity Framework

    Hi,i have table in SQL Server named Employees as follows:
    EmployeeId lastName FirstName reportsTo
    1 Davolio Nancy 2
    2 Fuller Andrew NULL
    3 Leverling Janet 2
    4 Peacock Margaret 2
    5 Buchanan Steven 2
    6 Suyama Michael 5
    7 King Robert 5
    8 Callahan Laura 2
    9 Dodsworth Anne 5
    I would like to use Entity Framework to populate my Model Class .My model class looks as follows:
    public class Employees
        readonly List<Employees> _children = new List<Employees>();
        public IList<Employees> Children
            get { return _children; }
        public string FirstName { get; set; }
        public string LastName {get; set;}
    I want to use this class in ViewModel  to populate my TreeView control. Can anyone help me in order to define Linq to Entities in order to populate my model class Employees from table in SQL Server as defined. Thanks in advance.
    Almir

    Hello Fred,
    unfortunately it does not work, maybe I can be more specific about what I'm trying to get. I'm following Josh Smith's article on CodeProject related to WFP TreeView
    Josh Smith article. He has Class named Person with the following structure
    public class Person
    readonly List<Person> _children = new List<Person>();
    public List<Person> Children
    get
    return _children;
    public string Name { get; set; }
    The same is populated from Database class using method named GetFamilyTree() which look as follows:
    public static Person GetFamilyTree()
    // In a real app this method would access a database.
    return new Person
    Name = "David Weatherbeam",
    Children =
    new Person
    Name="Alberto Weatherbeam",
    Children=
    new Person
    Name="Zena Hairmonger",
    Children=
    new Person
    Name="Sarah Applifunk",
    new Person
    Name="Jenny van Machoqueen",
    Children=
    new Person
    Name="Nick van Machoqueen",
    new Person
    Name="Matilda Porcupinicus",
    new Person
    Name="Bronco van Machoqueen",
    new Person
    Name="Komrade Winkleford",
    Children=
    new Person
    Name="Maurice Winkleford",
    Children=
    new Person
    Name="Divinity W. Llamafoot",
    new Person
    Name="Komrade Winkleford, Jr.",
    Children=
    new Person
    Name="Saratoga Z. Crankentoe",
    new Person
    Name="Excaliber Winkleford",
    I'm trying to figure out how should I write
    GetFamilyTree() method using Entity Framework in order to connect to my SQL Server database and populate this Person class as it was populated manually in Joshs Example. The table I'm using in SQL Server is described in
    my first post named Employees (it's self reference table)

  • Drag UserControl that uses Linq To Entities onto Windows Form, No Connection String named '' could be found in application config file

    I have created a Visual Studio 2013 Solution with two projects: A Windows Forms project and a Class Library project. In the Class Library project I have added an entity framework, resulting in an .edmx file and an app.config file. I have copied the app.config
    file to the Windows Forms project and added a reference to EntityFramework.dll and a reference to the Class Library.
    When there is no code in the user control, I can drag the user control onto the main windows form with no error. However, if I use Linq to Entities in my user control and then try to drag it onto my form, I get an error. 
    Code in User Control that causes error:
    adminentities = new ClassLibrary1.AdminEntities();
    var res = from pay in adminentities.PayrollSchedules.Where(x=>x.FiscalYear == 2015) select pay;
    The error is:
    Failed to create component 'NavigationUserControl'...'No connection string named 'AdminEntities' could be found in the application config file.'
    There IS an app.config file in the windows form project with a connection string named 'AdminEntities'. I have also tried a few suggestions I found: 1) Changed * in the connection string to use the namespace of the class library and 2) replaced &quot;
    with a single quote. Neither of these changes fixed the issue.
    How can I resolve this? Thank you.

    Hi RLuther,
    >> Failed to create component 'NavigationUserControl'...'No connection string named 'AdminEntities' could be found in the application config file.'
    Based on the error message, this issue would be related to the data platform, I suggest you post this issue to the
    ADO.NET Entity Framework and LINQ to Entities forum for dedicated support.
    The forum link:
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetentityframework
    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.

  • To read a connection string from a notepad

    i want to read the DSN-less connection string from a notepad that is from a text file so that if server ip address changes then it will be easy to change the ip address in the notepad rather than changing the code .we are using jsp.
    Connection con=DriverManager.getConnection("jdbc:odbc:DRIVER={SQL Server};Database=profile;Server=10.11.144.124;uid=sa;pwd=sa123");
    so this connection should be read from the text file
    any suggestions
    Thanks for ur help

    i want to read the DSN-less connection string from a
    notepad that is from a text file so that if server ip
    address changes then it will be easy to change the ip
    address in the notepad rather than changing the code
    .we are using jsp.
    Connection
    con=DriverManager.getConnection("jdbc:odbc:DRIVER={SQL
    Server};Database=profile;Server=10.11.144.124;uid=sa;p
    wd=sa123");
    so this connection should be read from the text file
    ny suggestions
    Thanks for ur help=> Good way of getting the DSN or any other setting from a text file is create a simple bean(will have get and may have set method too)that will read the data from the text file and use the bean anywhere in your jsp page(As it will also improve the performance of the application)and the bean initilizd once can be reused anywhere in the application.

  • Best Practices for Using Service Controller for Entity Framework Database

    I'm running into an issue in my first time creating a Web Service with a .NET backend with Azure. I designed a database in Entity Framework and had it create the models, but I couldn't create a controller for the table unless I made the model inherit from
    EntityData. Here's the catch, the Database Model has int Id, but EntityData has string Id, so, of course, I'm getting errors. What is best practice for what I'm trying to do?
    Michael DiLeo

    hi Michael,
    Thanks for you posting!
    Sorry for I am not totally understanding your issue. Maybe two points need your confirm:
    1. I confuse with the "Service controller"? IS your meaning MVC controller? Or ServiceController(http://www.codeproject.com/Articles/31688/Using-the-ServiceController-in-C-to-stop-and-start
    2.whether  The type of ID in the model is match to the database ? In other words, Is the type of IDin .edmx matched to the database?
    By the way, it seems that this issue is more related to EF. You could post this issue on EF discussion for better support.
    Thanks & Regards,
    Will
    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.

  • 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.

  • DSN to DSN-Less Connection

    Hi Guys,
    Some advice please, perhaps some suggestions on the best way
    forward please.
    I have inherited a Web site runnning on MS Access db's
    utilising DSN connections.
    I do not use DSN connections rather DSN-less connection
    strings.
    My question is, is there an easy way / operation, to convert
    all the connection strings to a DNS-less vesion. My host does not
    allow DSN connections where they set the alias on the server, hence
    my requirement.
    Any suggestions please. I could really do with an easy answer
    as I do not really wish to have to re-script the site.
    Thanks as always.
    Jules

    Sorry meant to post the recordset script too. Here is is
    <%@LANGUAGE="JAVASCRIPT"%>
    <!--#include file="Connections/bealdevelopments.asp"
    -->
    <%
    var cityliving = Server.CreateObject("ADODB.Recordset");
    cityliving.ActiveConnection = MM_bealdevelopments_STRING;
    cityliving.Source = "SELECT * FROM developments WHERE
    lifestylesection LIKE '%1%' AND live = '2'";
    cityliving.CursorType = 0;
    cityliving.CursorLocation = 3;
    cityliving.LockType = 1;
    cityliving.Open();
    var cityliving_numRows = 0;
    %>
    <%
    var countryliving = Server.CreateObject("ADODB.Recordset");
    countryliving.ActiveConnection = MM_bealdevelopments_STRING;
    countryliving.Source = "SELECT * FROM developments WHERE
    lifestylesection LIKE '%2%' AND live = '2'";
    countryliving.CursorType = 0;
    countryliving.CursorLocation = 2;
    countryliving.LockType = 1;
    countryliving.Open();
    var countryliving_numRows = 0;
    %>
    <%
    var familyliving = Server.CreateObject("ADODB.Recordset");
    familyliving.ActiveConnection = MM_bealdevelopments_STRING;
    familyliving.Source = "SELECT * FROM developments WHERE
    lifestylesection LIKE '%3%' AND live = '2'";
    familyliving.CursorType = 0;
    familyliving.CursorLocation = 2;
    familyliving.LockType = 1;
    familyliving.Open();
    var familyliving_numRows = 0;
    %>
    <%
    var watersideliving = Server.CreateObject("ADODB.Recordset");
    watersideliving.ActiveConnection =
    MM_bealdevelopments_STRING;
    watersideliving.Source = "SELECT * FROM developments WHERE
    lifestylesection LIKE '%4%' AND live = '2'";
    watersideliving.CursorType = 0;
    watersideliving.CursorLocation = 2;
    watersideliving.LockType = 1;
    watersideliving.Open();
    var watersideliving_numRows = 0;
    %>
    <%
    var Repeat1__numRows = -1;
    var Repeat1__index = 0;
    cityliving_numRows += Repeat1__numRows;
    %>
    <%
    var Repeat2__numRows = -1;
    var Repeat2__index = 0;
    countryliving_numRows += Repeat2__numRows;
    %>
    <%
    var Repeat3__numRows = -1;
    var Repeat3__index = 0;
    familyliving_numRows += Repeat3__numRows;
    %>
    <%
    var Repeat4__numRows = -1;
    var Repeat4__index = 0;
    watersideliving_numRows += Repeat4__numRows;
    %>

Maybe you are looking for