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

Sqlite Code Generation fails #834

Open
statler opened this issue Mar 6, 2024 · 6 comments
Open

Sqlite Code Generation fails #834

statler opened this issue Mar 6, 2024 · 6 comments

Comments

@statler
Copy link

statler commented Mar 6, 2024

I am trying to reverse engineer the attached Sqlite db with the given config. It fails with an uninformative warning. I tried debugging the T4, but that bails out after creating the configs for the primitives. Latest version. Any ideas?

Blankv120.zip

@sjh37
Copy link
Owner

sjh37 commented Mar 6, 2024 via email

@statler
Copy link
Author

statler commented Mar 6, 2024

OK - so it runs correctly if you use the debug T4 template function in VS, but fails if you try and run it on save.

@statler
Copy link
Author

statler commented Mar 7, 2024

OK, so it runs, but still generates incorrect configurations. Basically, if a class has multiple FKs to the same table, it will only add the first relationship . I expect that this line is the culprit
var constraints = fkList.Select(x => x.FkSchema + "." + x.ConstraintName).Distinct();

Because in the Sqlite config, the schema is identical, and the constraintname is built using the current table and FK Primary key ID, which is also the same. I expect this is a mistake, and the constraintname should include the local property.

@statler
Copy link
Author

statler commented May 27, 2024

Are you planning on fixing this?

@sjh37
Copy link
Owner

sjh37 commented May 28, 2024

Sorry @statler Yes I am. I'll take a look at this now.

@sjh37
Copy link
Owner

sjh37 commented May 28, 2024

The issue of multiple foreign keys to the same table has been fixed. Thanks for the heads-up on where to look. Foreign keys will have a different name though and will need to be changed in your code after the first run. Download the latest EF.Reverse.POCO.v3.ttinclude

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

No branches or pull requests

2 participants