My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 278: Two references to the same table cause DbMetal to crash (DbLinq-0.20.1)
2 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by gauthier...@yahoo.fr, Aug 23, 2010
Tested on linux x86 with SQLite 3.6.22 , DbLinq-0.20.1 , mono 2.6.7

CREATE TABLE pet (
    idpet INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    idmating INTEGER REFERENCES mating(idmating)
);
CREATE TABLE mating (
    idmating INTEGER PRIMARY KEY AUTOINCREMENT,
    idfather INTEGER REFERENCES pet(idpet),
    idmother INTEGER NOT NULL REFERENCES pet(idpet),
    matingday NUMERIC
);

./DbMetal.exe --provider=Sqlite --conn="Data Source=test.db" --code=testdb.cs --with-dbconnection="Mono.Data.Sqlite.SqliteConnection, Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" --debug
DbLinq Database mapping generator 2008 version 0.20
for Microsoft (R) .NET Framework version 3.5
Distributed under the MIT licence (http://linq.to/db/license)

>>> Reading schema from SQLite database
DbMetal: System.InvalidOperationException: Operation is not valid due to the current state of the object
  at System.Linq.Enumerable.Single[Association] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Single[Association] (IEnumerable`1 source, System.Func`2 predicate) [0x00000] in <filename unknown>:0 
  at DbMetal.Generator.Implementation.Processor.ValidateAssociations (DbLinq.Schema.Dbml.Database database, DbLinq.Schema.Dbml.Table table) [0x00000] in <filename unknown>:0 
  at DbMetal.Generator.Implementation.Processor.SchemaIsValid (DbLinq.Schema.Dbml.Database database) [0x00000] in <filename unknown>:0 
  at DbMetal.Generator.Implementation.Processor.ProcessSchema (DbMetal.Parameters parameters) [0x00000] in <filename unknown>:0 

I have the same error in MonoDevelop whith "Generate linq class"

Removing one of the two REFERENCES pet(idpet) solve it

Sign in to add a comment

Powered by Google Project Hosting