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

ef.core 7 support #263

Merged
merged 5 commits into from
Nov 12, 2022
Merged

ef.core 7 support #263

merged 5 commits into from
Nov 12, 2022

Conversation

MaceWindu
Copy link
Contributor

@MaceWindu MaceWindu commented Nov 12, 2022

Fix #262

Code based on v6 version, so there is more changes than expected due to fact that master had v5

@@ -14,8 +14,8 @@
<projectUrl>https://github.com/linq2db/linq2db.EntityFrameworkCore</projectUrl>
<license type="file">MIT-LICENSE.txt</license>
<dependencies>
<group targetFramework=".NETStandard2.1">
<dependency id="Microsoft.EntityFrameworkCore.Relational" version="5.0.17" />
<group targetFramework="net6.0">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

net7.0. ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -600,19 +599,19 @@ string PrepareExpressionText(Expression? expr)
{
// Handling NpgSql's PostgresBinaryExpression

var left = newExpression.GetType().GetProperty("Left")?.GetValue(newExpression) as Expression;
var right = newExpression.GetType().GetProperty("Right")?.GetValue(newExpression) as Expression;
var left = (Expression)newExpression.GetType().GetProperty("Left")?.GetValue(newExpression)!;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception? I don't think so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expression

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean this code will throw exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -278,7 +277,7 @@ static DataType DbTypeToDataType(DbType dbType)
{
(T)(Attribute)new ColumnAttribute
{
Name = prop.GetColumnName(storeObjectId!.Value),
Name = storeObjectId != null ? prop.GetColumnName(storeObjectId.Value) : null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storeObjectId is not value type anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, but there were assumption that GetStoreObjectIdentifier will return non-null value. I'm not sure it is always true, so I've replaced code a bit to treat it as nullable value to avoid NRE

@MaceWindu MaceWindu merged commit d1fd30f into master Nov 12, 2022
@MaceWindu MaceWindu deleted the infra/net7-migration branch November 12, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Compatible with EF Core 7?
2 participants