Search code examples
odp.netlightswitch-2013

Lightswitch lost data provider for data source connection


I have an odd situation on a VS upgrade from 2013 > 2015 outside of runtime.

App Type: MS Lightswitch HTML Client DB Type: Oracle Framework: 4.5

Story: I upgraded VS and replaced OPD.Net to the 2015 version. Works fine. Then I converted my application. There were a lot of things to fix, but most were pretty easily remedied. I tested the application and it works as expected so I published to test server and everything checks out. Success! So I thought.

I want to continue developing the site. As I make db changes, they need to be reconciled to the intrinsic db in my project.

enter image description here

After clicking 'Update Database' I see this. So far so good. enter image description here

What's expected is that after I hit 'Finish', all changes to the selected table should pull in to the lsml files. But this is what I get.

enter image description here I've read a few places like The given key was not present in the dictionary, what key? [closed] but these all look like runtime remediations.

If I go back to the update screen and hit 'Previous', I get this. enter image description here

I sifted through every freakin lsml file in text editor looking for where the provider is assigned. No luck. I also created a new proj to compare, nothing stood out. I also tried adding another data source which works fine. So ODP.net is not the issue. I am lost on what to do now. I searched all over the site, Google, for every error message with various tags. At this point I reach out to you, or anyone that may know what this is about.

Thanks ahead of time!


Solution

  • Note for future users upgrading a VS LS project with Oracle db. Since a new version ODP.Net is required (in my case 2015), the provider name is going to change. To ensure LS knows the new provider, the data source lsml file needs to be updated. In my case I used GIT to help out. This is how I resolved it.

    Steps: After converting your project and replacing ODP.net to the current version.

    1. Create a new data source using the new provider.
    2. Save the project and re-open. This will cause lightswitch to recompile.
    3. Open File Explorer and navigatye to the ProjectName.server folder. In a text editor (I used notepad) open the lsml files under ProjectName.server and there should be two lsml files (1 for the pre-existing and another for the new) or more if you have multiple sources.
    4. Copy the connection properties of the new datasource to a new temp file on your desktop.
    5. Roll back the entire solution using GIT or other source control.
    6. Use text editor to open the lsml file for the original data source.
    7. Update the GUID for DataProviderName with the values from the temp file in step 4.

    Note: The connection string GUID should be left alone as it should match your GUID in the web.config file.

         <DataService.ConnectionProperties>
          <ConnectionProperty
            Name="DataProviderName"
            Value="9d8fdbb9-xxxx-4787-xxxx-49831d34ad4b" />
          <ConnectionProperty
            Name="ProviderInvariantName"
            Value="Oracle.ManagedDataAccess.Client" />
          <ConnectionProperty
            Name="ConnectionStringGuid"
            Value="36e67aca-xxxx-41a7-xxxx-a4546761b30d" />
          <ConnectionProperty
            Name="ProviderManifestToken"
            Value="12.1" />
         </DataService.ConnectionProperties>
    
    1. Finally reload project and the changes should take effect allowing you to once again update your data source.

    Thanks