This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello - I have been using Microsoft's ODP.NET provider to connect with Oracle 11.1.0.7.0 - and it has been working successfully until today. I should say I am using the LightSpeed 4 nightly build from 6/20/12, VS 2010 SP1 and C#. I added some tables to the model and modified properties on the associations to pull in the appropriate tables on load (Generate BackReference Member reference, Eager Load, etc). Now I get the following errors when trying to read from the database:
The correct identifier is "ORDERS_ID". Going to the auto-generated code I see this:
Apparently the Column attribute is not being generated for some columns. This error is repeated at various places throughout the generated model.cs code. What did I do to break it? More importantly, how do I fix it? Thanks, Dave |
|
|
This sounds like a bug applying the correct column name. Are you able to send through a small repro project which we could look at to track down the cause of this and look into a fix?
|
|
|
Thanks for replying! Unfortunately I am about to leave the office for a couple of days. I'll see what I can do when I get back in on Friday, but by then you all will be on your weekend... Dave in Nebraska, where it feels like the Australian outback right now... |
|
|
Thanks Dave - just fire that through when you get the chance :)
|
|
|
Thinking about this, I'm not sure how to reproduce the issue without a database. I have read only access to the Oracle database here, so I can't send you DML code to build the data side of any sample I might create. I am sending you my model project which demonstrates the problem, but I'm not sure how much good that will do you without you actually being able to access the database. Please let me know what else I can do to help you here. I know you'd like to see a complete working example of the problem but without the ability to create a table you could build and access I'm not quite able to do that. The problem seems to be that not all of the column names are brought into the model. For instance, ORDERSID is the foreign key in ORDDETAIL to the ORDERS table. In IqmsModel.cs it does not have the column name attribute. In fact, it may even be only the foreign key values that exhibit this problem, as I can't seem to get past that to check any others... Interesting note, I did not get this error until I added the RMA, RMADETAIL and SHIPMENTDTL tables to the model. Anyway, see if you can see something in here. If not, please let me know what else I can do without creating a sample database. Dave |
|
|
Thanks Dave, I should be fine with just the model itself since I can generate the database schema from that. Do you have an example query I can use against the model which is causing the issue?
|
|
|
Here is a method / query that worked prior to updating the last time. As I said, I updated LightSpeed and then added some tables to the model (Rma, RmaDetail and ShipmentDtl) and it started failing. This query does not use the newly-added tables but still fails. Actually, it fails on the first line (unitOfWork.Orders.FirstOrDefault()).
From what I can tell, the columns that don't get the ColumnAttribute applied are the foreign key fields. Not sure if those are the only ones but it seems that way from what I can tell so far. I can go into the generated code and add those decorations and the model works -- until I do something that calls "Run Custom Tool" and that overwrites my changes (as I expected). Something else that may or may not be related - when I try to "Update From Source..." on the model I get the suggested edits in the attached file - top and bottom of the window, there are a lot of edits. Basically, if I were to apply these suggested edits I would strip every column from the ARINVT table and completely mess up the relationships on several other tables. Clearly something is wrong with the logic behind this, but I don't know if it is related or not. If it's not related, let me know and I'll start another thread to address it. Thanks, Dave |
|
|
Jeremy - I don't know if this is related or not, but I went into the generated model.cs code and added the missing declarations trying to move forward while waiting for feedback from you all. The query I sent you earlier works fine doing this, but this statement:
...gets me this exception: {Mindscape.LightSpeed.LightSpeedException: Unable to materialize field [VmiReturn] on type [IqmsModel.ShipmentDtl]. Check your table has an Id column and that your mappings are correct. See inner exception for details. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Mindscape.LightSpeed.Data.DataProviderAdapter.(Object[] , Int32 )
at Mindscape.LightSpeed.Model.FieldModel.<>cDisplayClassaf. I have no idea how to proceed from here... :( Going to the model.cs file I find VmiReturn declared as:
and
and
Nothing that would indicate a need for an index or even that this (nullable) field would need to be "materialized", whatever that means in this context. Help? |
|
|
Hi Dave, In terms of the missing column names on the association FK's, I think you will just need to add these in manually - I have done some quick testing here and the column name gets applied correctly for me when I update the schema accordingly so its a little unclear why this is occurring but you can just add this in manually by right clicking on the association and specifying the column name in the properties. On the designer prompting for updates - it sounds like your model is subtly out of sync with the database. My suggestion would be to just regenerate the whole model from the database (just remove and then redrag the tables on from the Server Explorer being the easiest approach) - if you still get issues with it wanting to update after this then we would really need to get an extract of the database schema to reproduce this here to be able to diagnose this further. Our process for updating just re-extracts the schema and then compares so regenerating it should ensure that everything is up to date.
|
|
|
Hi Dave, Also am not seeing any errors running:
on a database schema derived from the model, so this again points to a mismatch between the database and the model (perhaps another missing column name?)
|
|
|
Hi Jeremy - I got tied up today on other projects and haven't had enough time to get this rebuilt yet. There are several rules I need to add to make it all work right (eager loading, etc) and my first couple of attempts failed with Oracle errors on the generated queries. Since that has never been a problem prior to this I assume I am still am missing something so will keep working on it. Thanks for the help! Dave |
|
|
OK that seems to have done it. Annoying, but not the end of the world. Thanks for the response and keep up the good work! Dave |
|