Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two references to the same table cause DbMetal to crash (DbLinq-0.20.1) #278

Open
GoogleCodeExporter opened this issue Apr 24, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

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

Original issue reported on code.google.com by gauthier...@yahoo.fr on 23 Aug 2010 at 7:57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant