Many to many relationships

Many to many relationships

Postby DavidF » Mon 20 Jan 2014 09:19

I posted a support request for this issue on 15/1/14 and sent a follow-up email on 17/1/14 but I haven't received any response. I attached a test project that reproduces the problem.

The problem relates to many-many relationships in LinqConnect for Metro version 4.4.393 and above.

Creating a db with a many-many relationship works in version 4.4.383 In 4.4.393 this exception is thrown:

System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Devart.Data.Linq
StackTrace:
at Devart.Data.Linq.Engine.SqlSchemaBuilder. (ManyToManyMetaType , MetaDataMember )
at Devart.Data.Linq.Engine.SqlSchemaBuilder. (MetaTable , List`1 , List`1& , List`1& , List`1& )
at Devart.Data.Linq.Engine.SqlSchemaBuilder.GenerateCreateScripts(MetaModel )
at Devart.Data.Linq.DataProvider.CreateDatabase(Boolean ignoreErrors, Boolean createSchema)
at Devart.Data.SQLite.Linq.Provider.SQLiteDataProvider.CreateDatabase(Boolean ignoreErrors, Boolean createSchema)
at Devart.Data.Linq.DataProvider.7axdkwt3gfx52xqzykge2d4jpayt4hd5 (Boolean , Boolean )
at Devart.Data.Linq.DataContext.CreateDatabase(Boolean ignoreErrors, Boolean createSchema)
at Devart.Data.Linq.DataContext. . ()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at App24.MyDataContext.<DeployAsync>d__0.MoveNext() in c:\Users\david fowler\Documents\Visual Studio 2012\Projects\App24\App24\MyDataContext.cs:line 57
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at App24.MainPage.<Button_Click>d__0.MoveNext() in c:\Users\david fowler\Documents\Visual Studio 2012\Projects\App24\App24\MainPage.xaml.cs:line 40
InnerException:

In version 4.4.403 this exception is thrown:

System.NullReferenceException was unhandled by user code
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Devart.Data.Linq
StackTrace:
at Devart.Data.Linq.Engine.TablesSorter. (MetaTable , List`1 )
at Devart.Data.Linq.Engine.TablesSorter. ( , MetaTable )
at Devart.Data.Linq.Engine.TablesSorter.Sort(List`1 , List`1 , Dictionary`2 , Boolean )
at Devart.Data.Linq.Engine.SqlSchemaBuilder.Initialize(MetaModel , Boolean , List`1& )
at Devart.Data.Linq.Engine.SqlSchemaBuilder.GenerateCreateScripts(MetaModel )
at Devart.Data.Linq.DataProvider.CreateDatabase(Boolean ignoreErrors, Boolean createSchema)
at Devart.Data.SQLite.Linq.Provider.SQLiteDataProvider.CreateDatabase(Boolean ignoreErrors, Boolean createSchema)
at Devart.Data.Linq.DataProvider.7axdkwt3gfx52xqzykge2d4jpayt4hd5 (Boolean , Boolean )
at Devart.Data.Linq.DataContext.CreateDatabase(Boolean ignoreErrors, Boolean createSchema)
at Devart.Data.Linq.DataContext. . ()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at App24.MyDataContext.<DeployAsync>d__0.MoveNext() in c:\Users\david fowler\Documents\Visual Studio 2012\Projects\App24\App24\MyDataContext.cs:line 57
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at App24.MainPage.<Button_Click>d__0.MoveNext() in c:\Users\david fowler\Documents\Visual Studio 2012\Projects\App24\App24\MainPage.xaml.cs:line 40
InnerException:
DavidF
 
Posts: 18
Joined: Fri 11 Oct 2013 10:07

Re: Many to many relationships

Postby MariiaI » Mon 20 Jan 2014 09:23

We have contacted you by e-mail.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Many to many relationships

Postby DavidF » Mon 20 Jan 2014 10:14

MariiaI wrote:We have contacted you by e-mail.


I haven't received an email.
DavidF
 
Posts: 18
Joined: Fri 11 Oct 2013 10:07

Re: Many to many relationships

Postby MariiaI » Mon 20 Jan 2014 10:16

We have reproduced this issue with your sample project. We will investigate it and inform you about the results as soon as possible.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Many to many relationships

Postby MariiaI » Tue 21 Jan 2014 13:29

We have fixed this issue. We will inform you when the corresponding build of LinqConnect for Metro is available for download.
As a temporary workaround, please replace this code:
Code: Select all
builder.Entity<Class2>().Association()
    .ToMany(class2 => class2.Class1s)
    ...

with this:
Code: Select all
builder.Entity<Class2>().Association()
    .Name("SomeUniqueName")  // add name for the association
    .ToMany(class2 => class2.Class1s)
    ...
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to LinqConnect (LINQ to SQL support)