JetEntityFrameworkProvider icon indicating copy to clipboard operation
JetEntityFrameworkProvider copied to clipboard

Boolean fields marked as pk and also pk fields not marked as such in edmx model

Open alessaro92 opened this issue 6 years ago • 4 comments

It's the first time I use this EF provider to work with access databases and I'm trying to configure the database first mode, creating the edmx model from a database file which has always been used as a reference for application development and test. I suppose the access file I'm working with was created with a fairly old version of office: it has MDB extension. The model generated from this file contains a table whose boolean fields have been marked as primary key even though they aren't part of primary key of the table in the database. So I tried editing the table removing some fields, and I got another strange result generating again the model: the boolean fields are not part of primary key anymore, but the fields that are part of the primary key are not defined as such in the model, only one of four fields has been marked as primary key. I am not able to understand why there is this behaviour, so I attach here the two database file and the screenshots of the models generated from them. I used Microsoft JET 4.0 as a provider.

edmx_model_test1 edmx_model_test2 test_db_files.zip

alessaro92 avatar Nov 12 '18 09:11 alessaro92

Have you abandoned this project in order to work only on the .NET Core one?

alessaro92 avatar Jan 04 '19 11:01 alessaro92

I'm still working on this project (more than .NET Core because in my "real life" I still use EF 6.2). The problem is the informations returned from OLEDB (that depends also on OLEDB version). I suggest to use Code First from Database approach so you can fix errors like this on classes.

bubibubi avatar Jan 04 '19 11:01 bubibubi

Ok, thanks. I was wondering that because I saw your activity on other projects and these issues were left ignored. Do you mean the issue is in the OLEDB which returns a kind of information schema with wrong informations? Is there any chance to fix?

alessaro92 avatar Jan 04 '19 11:01 alessaro92

You could try to use a newer version of oledb (>=12)

I'm updating ef core provider to version 2.2, after that I will have a look to this issue (but I think that it's a oledb bug).

bubibubi avatar Jan 05 '19 06:01 bubibubi