Comments (10)
Hey @Alfetta159
Can you please confirm the versions of these packages that you're using?
- Microsoft.EntityFrameworkCore
- Microsoft.EntityFrameworkCore.Relational
- EntityFrameworkCore.OpenEdge
You should have 2.1.11 for the EF Core packages and 1.0.8 for the EntityFrameworkCore.OpenEdge
.
If you try to use a newer, unsupported version of EF Core it can cause issues.
Also can you please let me know if you're trying to map a LOGICAL
field to something other than bool
or bool?
Note that if an OpenEdge field is not marked as Mandatory
then it will need to be mapped to a nullable type in your Entity.
Eg. a non-Mandatory LOGICAL
in OpenEdge <=> bool?
in .NET
from entityframeworkcore.openedge.
EntityFrameworkCore.OpenEdge 1.0.8
Microsoft.EntityFrameworkCore 2.2.6
Microsoft.EntityFrameworkCore.Relational 2.2.6
I realize these are forward of the requirement, but I have checked it with the 2.1.11 versions and I get the same result.
Keep in mind that I am not trying to map anything. I'm using the Scaffolding cmdlet to generate the database context and models, so I'm expecting the database provider to do that mapping.
Again: I'm not familiar with creating a db context provider. How do you debug one? Is it a matter of running the edmgen.exe or does that not work with .NET core? If you would enlighten me, I could give you better information as to the types/fields the provider is finding in my database (which is a third party database) and how it's having trouble.
Thx again!
from entityframeworkcore.openedge.
OK that is interesting. I haven't had this problem before and I have scaffolded large databases before.
I'm not sure if there is an easy way to debug it as it's a part of the actual EF Core tooling, the provider essentially just generates the metadata used by the EF Core tooling.
Is there a way you can trace it down to a specific table and/or column that might be causing the issue?
I'll take a look at the boolean/logical type mapping code on my side and see if there is anything obvious.
from entityframeworkcore.openedge.
Are you able to run this SQL statement against the database and send me the result? It will return a record set of the datatypes used by the fields in your database. There may be a datatype that you're using that's tripping up the model generator that I'm not using myself.
SELECT "_Data-Type" FROM pub."_Field" GROUP BY "_Data-Type"
from entityframeworkcore.openedge.
_Data-Type |
---|
character |
date |
integer |
decimal |
logical |
raw |
recid |
datetime-tz |
int64 |
blob |
fixchar |
short |
timestamp |
double |
time |
float |
bigint |
clob |
datetime |
from entityframeworkcore.openedge.
hey @Alfetta159
I believe I've found the issue - I was able to reproduce the problem when I was using a version of the EF Core design-time tools that was newer than 2.1.11.
I believe when you tested with version 2.1.11 Visual Studio/Package Manager was actually still using the incorrect version of the design-time tools assembly (Microsoft.EntityFrameworkCore.Design).
Can you please remove EntityFrameworkCore.OpenEdge as well as all of the Microsoft.EntityFrameworkCore packages from your project, then re-add EntityFrameworkCore.OpenEdge (version 1.0.8 or newer). This should automatically add EF Core 2.1.11 to the project.
Then restart VS to make sure the right version of the design assembly is loaded, then try the scaffold again.
I am planning on updating the provider to version 2.2.6 when I get some free time, but for now please ensure all EF Core packages are version 2.1.11
Thanks!
from entityframeworkcore.openedge.
You're right. I set up a test project based on .Net Core 2.1 with the 2.1.11 EF libraries and it worked much better, but...
There are still a lot of warnings. I've condensed them down and removed table and column names. I did notice that a lot of these are missing from the OpenEdgeTypeMappingSource
constructor when I was poking around earlier. Here is the abbreviated list:
Could not find type mapping for column '' with data type 'recid'. Skipping column.
Could not scaffold the primary key for ''. The following columns in the primary key could not be scaffolded: _Cp-Dbrecid.
Unable to generate entity type for table ''.
Could not find type mapping for column '' with data type 'blob'. Skipping column.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for ''. The following columns in the primary key could not be scaffolded: _Db-recid.
Unable to generate entity type for table ''.
Could not scaffold the primary key for ''. The following columns in the primary key could not be scaffolded: _Con-recid.
Unable to generate entity type for table ''.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for 'pub._Db-Option'. The following columns in the primary key could not be scaffolded: _Db-recid.
Unable to generate entity type for table 'pub._Db-Option'.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for ''. The following columns in the primary key could not be scaffolded: _File-recid.
Unable to generate entity type for table ''.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for ''. The following columns in the primary key could not be scaffolded: _File-Recid.
Unable to generate entity type for table ''.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for ''. The following columns in the primary key could not be scaffolded: _File-Recid.
Unable to generate entity type for table ''.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for ''. The following columns in the primary key could not be scaffolded: _File-recid.
Unable to generate entity type for table ''.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for 'pub._Index-Field'. The following columns in the primary key could not be scaffolded: _Index-recid.
Unable to generate entity type for table 'pub._Index-Field'.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for 'pub._Sequence'. The following columns in the primary key could not be scaffolded: _Db-recid.
Unable to generate entity type for table 'pub._Sequence'.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not scaffold the primary key for 'pub._StorageObject'. The following columns in the primary key could not be scaffolded: _Db-recid.
Unable to generate entity type for table 'pub._StorageObject'.
Could not find type mapping for column '' with data type 'double'. Skipping column.
Could not find type mapping for column '' with data type 'fixchar'. Skipping column.
The column '' would normally be mapped to a non-nullable bool property, but it has a default constraint. Such a column is mapped to a nullable bool property to allow a difference between setting the property to false and invoking the default constraint. See https://go.microsoft.com/fwlink/?linkid=851278 for details.
Could not find type mapping for column '' with data type 'blob'. Skipping column.
Could not find type mapping for column '' with data type 'clob'. Skipping column.
from entityframeworkcore.openedge.
hey - I found that as well and already fixed the blob
, double
, and recid
- they weren't mapped properly.
I have released 1.0.9-rc1 and it will work with those types, as well as clob
(it is a pre-release nuget package so make sure you choose pre-release option if searching within VS).
If it works for you I will promote it to 1.0.9 full release version.
The fixchar
you can ignore, it's not actually usable from SQL - it's an internal OpenEdge thing.
The other warning you can ignore as it's to do with nullable bool having a default value (see more info here and here)
You will also notice it scaffolds internal tables as well (those starting with _
) - I am looking at ways to control that, but for now scaffolding everything is better than a subset, and you can always delete those internal ones from your model once scaffolded.
from entityframeworkcore.openedge.
That does work much better, thank you. Let me use it a bit more for a day or two before you RTM.
TL;DR My real challenge here is using a third-party enterprise application that doesn't have a proper API: SOAP, REST, Odata or otherwise.
We do have an SSIS project that replicates this data or at least the data that we really need into SQL Server, but that's not real time, and the SSIS project was created w/o considering EF and scaffolding so almost no SQL server tables has a key field and therefore EF to SQL Server can't generate the many tables this db has (nearly 2000). Likewise, most of the real data comes out of views which is still feasible with EF, but very tedious as they can't be scaffolded. Also, many of those views are used for something else, so I end up really needing to write my own views so I don't break something else.
Here, I'm hoping to scaffold the tables that I need into an EF library, and then expose that thru an odata API so my other business APIs can just query for what they need in real-time, but my Oauth2 middleware is written in .NET Core 2.2, so I might have to use this with a pass-thru proxy that worries about auth until this library is updated to 2.2.
from entityframeworkcore.openedge.
OK great. That’s pretty much what we’re doing in production but closer to 400 tables. There are issues/quirks with the way the OE SQL agent behaves; most of the work in creating this provider was to workaround those issues. Simple SQL queries work well but the more complex ones that EF Core generates could sometimes cause issues.
I have a branch prerelease/1.0.10 that targets 2.2.x which you can try out in your project while targeting .NET Core 2.2 as well. I have fixed a few issues relating to the migration to 2.2 but there are still a couple of issues remaining related to parameters, which can be tricky to diagnose. Once I have those sorted it should be good for 2.2.
from entityframeworkcore.openedge.
Related Issues (16)
- Migrations do not work
- Select query returns mangled data. HOT 5
- Support for extent specifier? HOT 2
- Scaffold and Multi Database Connection
- [OPENEDGE]Column "TIMESTAMP" cannot be found or is not specified for query. HOT 4
- Add <owner>.pub.<table> on TableVisit HOT 1
- is OpenEdge 10.2 A version supported HOT 1
- Scaffold-DbContext doesn't work HOT 2
- Count() expects Int32. OpenEdge returns Int64 HOT 1
- How to work with datetime fields in a update transaction? HOT 2
- .Net 6 support HOT 1
- No params allowed in select list HOT 1
- PopulateDebugInfo missing HOT 6
- Tables and Columns HOT 1
- Scaffold-DbContext remoting error HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entityframeworkcore.openedge.