Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Uncaught TypeError: Cannot read property 'LogicalType' of undefined #116

Open
dmeierotto opened this issue Jul 18, 2013 · 11 comments
Open

Comments

@dmeierotto
Copy link

Hi There!

I just started using JayData 1.3.1(with AngularJS 1.1.5 and ASP.Net WebAPI Odata backend(5.0.0-beta2 nuget package) with Entity Framework 5.0 Code First for data access.

I was able to generate the proxy classes using your utility and now when I create the context I get the error:

Uncaught TypeError: Cannot read property 'LogicalType' of undefined (line 10401 in JayData.js in the function _buildDbType_navigationPropertyComplite)

Here is the file with the proxy classes:

https://skydrive.live.com/redir?resid=546F075BD4456095!7728&authkey=!AK5PqA08PG0JZfs

Any suggestions?

@agdolla
Copy link
Contributor

agdolla commented Jul 18, 2013

how do you create the context ? which browser do you use ?

@dmeierotto
Copy link
Author

I am using Chrome 28.

Here is the code I use to create the context:

       var oProviderConfig = {
           name: 'oData',
           oDataServiceHost: '/dcpms2/odata'
       };

       return new Default.Container(oProviderConfig);

@robesz
Copy link
Collaborator

robesz commented Jul 18, 2013

Great, our guess is that you begin to use the context right after the creation.

YourContextInstance.onReady(function() {
    //Work with context now
});

This is necessary, because the context creation requires some time. Using the onReady helps you to make sure you are working on a context instance that was successfully inialized.

does this fix the problem?

@dmeierotto
Copy link
Author

No this does not solve it. Here is the code I use to try to fetch data:

dataService.onReady(function () {
dataService.Jobs.toArray(function (job) {
console.log(job);
});
});

@agdolla
Copy link
Contributor

agdolla commented Jul 18, 2013

did you include datajs before jaydata ?

@dmeierotto
Copy link
Author

Yes

Sent from my Windows Phone


From: agdollamailto:notifications@github.com
Sent: ‎7/‎18/‎2013 17:22
To: jaydata/jaydatamailto:jaydata@noreply.github.com
Cc: Danmailto:dan.meierotto@gmail.com
Subject: Re: [jaydata] Uncaught TypeError: Cannot read property 'LogicalType' of undefined (#116)

did you include datajs before jaydata ?


Reply to this email directly or view it on GitHub:
#116 (comment)

@agdolla
Copy link
Contributor

agdolla commented Jul 18, 2013

OK, I could reproduce it, you can see it here :) http://jsfiddle.net/JayData/CsWd8/
We're on it.

@agdolla
Copy link
Contributor

agdolla commented Jul 18, 2013

to me this looks like a problem:
'inverseProperty':'$$unbound'

could you share your $metadata ?

@dmeierotto
Copy link
Author

@agdolla
Copy link
Contributor

agdolla commented Jul 22, 2013

The problem is that certain entitysets are missing like WorkExchangeCodeLocation and other entities refer to these entities as navigation properties like WorkExchangeCode. This is not supported.
You can:

  1. have all entities exposed that are referenced
  2. remove navigaiton properties that reference to non-exposed entities
  3. jaysvcutil has been enhanced with some new features with which you can select which part of $metadata is used, this new feature might be of your help. You can read about it here: http://jaydata.org/blog/jaysvcutil.exe-update%E2%80%93-filter-on-what-gets-imported-from-odata-metadata

@dmeierotto
Copy link
Author

That is what I was afraid of. Adding the IgnoreDataMember attribute to properties I don't need in this API is also an option. In the end I think I will just have to create a new model and do mapping on the server. Trying to expose just those properties needed seems like a hassle no matter how you look at it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants