Changing the default collection type for the navigation properties causes an exception

5 posts, 0 answers
  1. Yassine
    Yassine avatar
    9 posts
    Member since:
    Dec 2012

    Posted 01 Dec 2014 Link to this post

    Hello everyone, first, thanks for this awesome ORM.
    i'm having a hard time changing the default collection type for the navigation properties in a one-to-many or many-to-many association.
    i found this part in the docs
    http://docs.telerik.com/data-access/developers-guide/code-generation/customizing-code-generation/domain-model/data-access-tasks-customise-code-generation-collection-generation
    but, when i apply the mentioned changes, i get the exception
    ****
    An exception of type 'Telerik.OpenAccess.Exceptions.DataStoreException' occurred in Telerik.OpenAccess.dll but was not handled in user code

    Additional information: Link table batch insert failed: Telerik.OpenAccess.RT.sql.SQLException: Invalid object name 'Categorie_Cheque'. ---> System.Data.SqlClient.SqlException: Invalid object name 'Categorie_Cheque'.

       at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)

       at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)

       at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)

       at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows)

       at OpenAccessRuntime.Intellitrace.Update(String id, DbDataAdapter adapter, DataRow[] rows)

       at Telerik.OpenAccess.RT.sql.Batch.Perform(String connId, DbDataAdapter adapter, DataRow[] rows)

       at Telerik.OpenAccess.Runtime.Logging.LoggingDbCommand.ExecuteBatch(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.CommandImp.Execute(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.Execute(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       --- End of inner exception stack trace ---

       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.Execute(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       at OpenAccessRuntime.Relational.conn.LoggingStatement.Execute(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       at Telerik.OpenAccess.RT.sql.Batch.ExecuteBatchDataTable(Boolean withInfo)

    Field: Telerik.OpenAccess.TrackedBindingList`1[[Taxwise.Cheques.Cheque, Taxwise.Cheques, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] Taxwise.Cheques.Categorie._cheques

    INSERT INTO [Categorie_Cheque]([Id], [seq], [Id2]) VALUES (@p0, @p1, @p2)

    Batch Entry 0 (set event logging to all to see parameter data) Telerik.OpenAccess.RT.sql.SQLException: Invalid object name 'Categorie_Cheque'. ---> System.Data.SqlClient.SqlException: Invalid object name 'Categorie_Cheque'.

       at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)

       at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)

       at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)

       at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows)

       at OpenAccessRuntime.Intellitrace.Update(String id, DbDataAdapter adapter, DataRow[] rows)

       at Telerik.OpenAccess.RT.sql.Batch.Perform(String connId, DbDataAdapter adapter, DataRow[] rows)

       at Telerik.OpenAccess.Runtime.Logging.LoggingDbCommand.ExecuteBatch(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.CommandImp.Execute(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.Execute(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       --- End of inner exception stack trace ---

       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.StatementImp.Execute(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       at OpenAccessRuntime.Relational.conn.LoggingStatement.Execute(DbDataAdapter adapter, DataRow[] rows, Batch batch)

       at Telerik.OpenAccess.RT.sql.Batch.ExecuteBatchDataTable(Boolean withInfo)
  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 02 Dec 2014 Link to this post

    Hello Yassine,

    I think you changed from foreign key collection to a join table collection. In order to make the transition complete, you will need to allow DataAccess to update the database schema, otherwise the join table will not be created and an exception like the one you've got will be thrown. 
    In order to do that you will need to control the 'Update Schema' property of the referencing class, set it to true and perform the 'Update Database from Model...' operation on the .rlinq designer.

    Regards,
    Thomas
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. Yassine
    Yassine avatar
    9 posts
    Member since:
    Dec 2012

    Posted 02 Dec 2014 in reply to Thomas Link to this post

    thank you for your answer and your time, can you elaborate on the "Update scheme" part, with an example if possible, i'm fairly new to Telerik dataAccess. 
    Thanks again.
  5. Yassine
    Yassine avatar
    9 posts
    Member since:
    Dec 2012

    Posted 02 Dec 2014 Link to this post

    it's ok, i found it, and it's working flawlessly, thanks Sir.
  6. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 05 Dec 2014 Link to this post

    Hi Yassine,

    we are happy you have resolved the issue. 

    Should you have any further questions do not hesitate to get back to us. 

    Regards,
    Kaloyan Nikolov
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
Back to Top
DevCraft banner