Page 1 of 1

new new association

Posted: Fri 02 May 2014 16:43
by hepek
I understand it is not possible to create relation if the two columns do not match.

I have table 1 containing column DOCUMENT_ID NUMBER NOT NULL
table 2 has the same column but this column is NULLABLE

devart would not let me create relation between two tables since the seconds column is specified as NULLABLE.

Is there any way around?
I cannot change the database structure since other applications are using it.

thanks
Nermin

Re: new new association

Posted: Mon 05 May 2014 10:20
by MariiaI
You are working with a LinqConnect model and trying to add a 1-to-1 association, aren't you?
If yes, then the possibility to add 1-to-1 associations with nullable foreign key properties was added in LinqConnect 4.2.306/dotConnect for Oracle 7.8.301 (released on 08-Aug-13):
http://forums.devart.com/viewtopic.php?f=1&t=27701.

If it is your case, please upgrade your dotConnect for Oracle to a newer one.

Re: new new association

Posted: Mon 05 May 2014 14:00
by hepek
thank you

Re: new new association

Posted: Mon 05 May 2014 14:54
by hepek
I have another question.

I imported a table definition in diagram (.lqlml) by pasting XML like indicated below.
I run a custom tool on my diagram and it did create this entity.
However - I can't find this entity in a diagram, I mean I can find it when I do the search, but the entity itself does not show up in diagram. I can access this entity, intelisense is working fine and all that - but it does not show in a diagram. I have dotConnect version 7.7.267

Please advice.
thank you

Code: Select all

  <Table Name="OPL.ESP_EDGAR_DOCUMENTS" Member="EspEdgarDocuments">
    <Type Name="EspEdgarDocument" ed:Guid="953b0167-b067-485a-b6eb-b75505022007">
      <Column Name="DOCUMENT_ID" Member="DocumentId" Type="System.Int64" DbType="NUMBER(16) NOT NULL" IsPrimaryKey="true" CanBeNull="false" Precision="16" ed:ValidateRequired="True" ed:Guid="0863a945-571f-4de2-9d4a-40a91ad9e457" />
      <Column Name="SUBMISSION_TYPE_ID" Member="SubmissionTypeId" Type="System.Int32" DbType="NUMBER(3) NULL" CanBeNull="true" UpdateCheck="Never" Precision="3" ed:ValidateRequired="False" ed:Guid="f01aa5a9-96ab-4514-8eba-79c7951a48e2" />
    </Type>
  </Table>

Re: new new association

Posted: Tue 06 May 2014 07:07
by MariiaI
Please open Model Explorer-> YourDataContext-> Classes and:
- drag the "EspEdgarDocument" class on the diagram
or
- right-click the "EspEdgarDocument" class and select "Add On Diagram" from the shortcut menu.

Re: new new association

Posted: Tue 06 May 2014 14:24
by hepek
thank you

Re: new new association

Posted: Wed 07 May 2014 07:13
by MariiaI
If you have any further questions, feel free to contact us.

Re: new new association

Posted: Wed 07 May 2014 13:33
by hepek
I do have another question.

I need to create a "clone row" functionality. For example I have table called JOB, and I want to clone one job to another. First I need to retrieve the original record from database, change the primary key and insert new record in back to database.

Of course dotConnect would not let me do this, since it has a self-tracking feature.
It won't let me change the primary key.

is there a way to detach entity once retrieved from database, so I could just change pk for the records and insert in into database as new record?

thanks

Re: new new association

Posted: Thu 08 May 2014 11:14
by MariiaI
is there a way to detach entity once retrieved from database, so I could just change pk for the records and insert in into database as new record?
It is impossible to detach objects from the DataContext, please refer to: http://www.devart.com/linqconnect/docs/?attach.html

You can try using this code to implement your scenario:

Code: Select all

SCOTTContext.SCOTTDataContext dt = new SCOTTContext.SCOTTDataContext();
SCOTTContext.DEPT entOld = dt.DEPTs.First();

SCOTTContext.SCOTTDataContext dt2 = new SCOTTContext.SCOTTDataContext() { Log = Console.Out };
SCOTTContext.DEPT entNew = entOld;
entNew.DEPTNO = 10;// new id
dt2.DEPTs.InsertOnSubmit(entNew);
dt2.SubmitChanges();
If you have any further questions, feel free to contact us.

Re: new new association

Posted: Thu 08 May 2014 13:44
by hepek
thank you