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:
Many to many relationships
Re: Many to many relationships
We have contacted you by e-mail.
Re: Many to many relationships
I haven't received an email.MariiaI wrote:We have contacted you by e-mail.
Re: Many to many relationships
We have reproduced this issue with your sample project. We will investigate it and inform you about the results as soon as possible.
Re: Many to many relationships
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:
with this:
As a temporary workaround, please replace this code:
Code: Select all
builder.Entity<Class2>().Association()
.ToMany(class2 => class2.Class1s)
...
Code: Select all
builder.Entity<Class2>().Association()
.Name("SomeUniqueName") // add name for the association
.ToMany(class2 => class2.Class1s)
...