Can Visual Studio Lightswitch connect to an oracle database?
Asked Answered
R

4

7

All the demos of Visual Studio Lightswitch use SQL-Server, it is possible to access data from Oracle using Visual Studio Lightswitch?

Rickirickie answered 5/8, 2010 at 11:48 Comment(2)
see also meta.stackexchange.com/questions/59759/…Rickirickie
Ian: I left an answer for you. You have three options (1) Oracle's ODP.Net 11.2 R4, (2) Third Party Drivers $$$, and (3) Open Source. @Matt Eisenberg was on the right track, but there's more options.Laminous
L
6

Visual Studio Lightswitch can be persisted to an Oracle Database via the Entity Framework.

  1. Oracle Data Provider (ODP.Net)

    Oracle's ODAC Tools contains the Oracle Data Provider (ODP.Net) for use with Visual Studio applications. Oracle's latest driver with support for Entity Framework 4.1 and "Model First" approach.

    EDIT: I am not sure if it supports "Code-First" or EF 4.2 so check documentation. That said, it's free and supported by Oracle so I would strongly suggest starting here before rolling your own, or using open source providers/drivers.

    Download ODP.Net 11.2.0.3

    EF Tutorial w/ ODP.Net

    Notes: "11.2.0.2 Release 4" will cut it, but "11.2.0.3 is" out and more stable.

  2. Third party drivers are available for purchase:

    docConnect for Oracle

    DevArt's ADO.Net Provider for Oracle

  3. Open Source Providers

    In addition there are some open source options available - one I found on Github:

    https://github.com/object/NorthwindOData


Tutorial on MSDN: How to Connect Lightswitch to EF 4.1

Laminous answered 18/1, 2012 at 23:51 Comment(2)
Is there every a version of the Oracle's ODAC Tools that is not in beta but does fully surport the shipping version of .net?Rickirickie
Yes. I forgot to edit my answer - 11.2.0.3 is is fully released, not beta... and it supports Entity Framework 4.1 - caveat: it supports "model first" and "4.1"... you'd have to read documentation or ask Support if 4.1 and Code-First approaches are good.Laminous
K
7

Yes, if you can get a third-part provider for the entity framework. I actually asked this question at VSLive this week.

Kilt answered 6/8, 2010 at 1:24 Comment(3)
how much do the third-part provider for the entity framework cost? And does someone need to know how to program to hook it into Lightswitch?Rickirickie
web.datadirect.com/products/net/net-for-oracle/index.html. Not sure about the second part of your question.Kilt
As far the second part, I believe, that once it's installed on the person's machine, they just choose that as a data source. They'll need to know connection information, just as if they were using any other data source. But shouldn't need programming knowledge to hook it up.Plastid
L
6

Visual Studio Lightswitch can be persisted to an Oracle Database via the Entity Framework.

  1. Oracle Data Provider (ODP.Net)

    Oracle's ODAC Tools contains the Oracle Data Provider (ODP.Net) for use with Visual Studio applications. Oracle's latest driver with support for Entity Framework 4.1 and "Model First" approach.

    EDIT: I am not sure if it supports "Code-First" or EF 4.2 so check documentation. That said, it's free and supported by Oracle so I would strongly suggest starting here before rolling your own, or using open source providers/drivers.

    Download ODP.Net 11.2.0.3

    EF Tutorial w/ ODP.Net

    Notes: "11.2.0.2 Release 4" will cut it, but "11.2.0.3 is" out and more stable.

  2. Third party drivers are available for purchase:

    docConnect for Oracle

    DevArt's ADO.Net Provider for Oracle

  3. Open Source Providers

    In addition there are some open source options available - one I found on Github:

    https://github.com/object/NorthwindOData


Tutorial on MSDN: How to Connect Lightswitch to EF 4.1

Laminous answered 18/1, 2012 at 23:51 Comment(2)
Is there every a version of the Oracle's ODAC Tools that is not in beta but does fully surport the shipping version of .net?Rickirickie
Yes. I forgot to edit my answer - 11.2.0.3 is is fully released, not beta... and it supports Entity Framework 4.1 - caveat: it supports "model first" and "4.1"... you'd have to read documentation or ask Support if 4.1 and Code-First approaches are good.Laminous
B
3

I have used the latest ODAC 11.2 Release 4 (11.2.0.3.0) that supports Entity Framework, and it works fine.

If you get this error, "Inner exception message: Connection is already part of a local or a distributed transaction"

you can resolve the issue by following the second post by BScholz, https://forums.oracle.com/forums/thread.jspa?threadID=2263095

Basically, you need to implement SaveChanges_Excuting and SaveChanges_Excuted for the Oracle Data Source.

  1. Switch to "File View" (LightSwitch will display "Logical View" by default).
  2. Add a reference to "System.Transactions" in Server project.
  3. Switch back to "Logical View"
  4. Right Click the Data Source Name and click "View Code" to edit partial class.
  5. Copy-and-paste the code below:

    private TransactionScope _tscope;
    
    partial void SaveChanges_Executing()
    {
        _tscope = new TransactionScope(TransactionScopeOption.Required,
        new TransactionOptions
        {
            IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
        });
    }
    
    partial void SaveChanges_Executed()
    {
        _tscope.Complete();
        _tscope.Dispose();
    }
    
Buehler answered 14/1, 2012 at 7:43 Comment(0)
U
0

The LightSwitch training kit has an exercise dedicated to using alternative data sources via WCF RIA services.

You might find that useful.

Unhopedfor answered 21/9, 2010 at 16:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.