-
Notifications
You must be signed in to change notification settings - Fork 23
Update to ODL 9.x preview, .NET 10 support and bump version to 3.x preview1 #59
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
Conversation
|
/AzurePipelines run |
|
No pipelines are associated with this pull request. |
| /// </summary> | ||
| /// <param name="property">Reference to the calling primitive property configuration.</param> | ||
| /// <returns>Returns itself so that multiple calls can be chained.</returns> | ||
| public static PrimitivePropertyConfiguration AsTimeOfDay(this PrimitivePropertyConfiguration property) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does TimeOfDay here need to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is public, we can mark as Obsolete in 2.x and remove it here completely. For now, I have added another public method called AsTimeOnly(...).
Same applied to AsDate(...)
| throw Error.ArgumentNull("property"); | ||
| } | ||
|
|
||
| if (!TypeHelper.IsTimeSpan(property.RelatedClrType) && !TypeHelper.IsTimeOnly(property.RelatedClrType)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand the logic here... We're check if the CLR type is TimeSpan or TimeOnly and if not, we're thrown an exception saying the CLR type for the property must be a TimeSpan. Please explain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AsDateOnly(...) extension method sets the property's target EDM type to EdmPrimitiveTypeKind.Date when the property is of type System.DateTime or System.DateOnly, ensuring the property is treated as a date in the OData metadata.
The AsTimeOnly(...) extension method sets the property's target EDM type to EdmPrimitiveTypeKind.TimeOfDay when the property is of type System.TimeSpan or System.TimeOnly.
| property.DeclaringType.FullName); | ||
| } | ||
|
|
||
| property.TargetEdmTypeKind = EdmPrimitiveTypeKind.TimeOfDay; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the TimeOfDay enum member going to change to TimeOnly or did we decide to save ourselves the trouble?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TimeOfDay and Date as EdmPrimitiveTypeKind enum members will remain as they are for now. But eventually, we will have to rename them correctly.
| /// </summary> | ||
| /// <param name="property">Reference to the calling primitive property configuration.</param> | ||
| /// <returns>Returns itself so that multiple calls can be chained.</returns> | ||
| public static PrimitivePropertyConfiguration AsTimeOnly(this PrimitivePropertyConfiguration property) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I'm a bit confused here. This method is named AsTimeOnly but inside the body, we only if the CLR type of the property is TimeSpan and throw an exception if it is not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AsDateOnly(...) extension method sets the property's target EDM type to EdmPrimitiveTypeKind.Date when the property is of type System.DateTime or System.DateOnly, ensuring the property is treated as a date in the OData metadata.
The AsTimeOnly(...) extension method sets the property's target EDM type to EdmPrimitiveTypeKind.TimeOfDay when the property is of type System.TimeSpan or System.TimeOnly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WanjohiSammy Why can't one of AsTimeOfDay and AsTimeOnly call the other instead of duplicating the code? Maybe AsTimeOfDay should call AsTimeOnly since AsTimeOfDay is what we might deprecate in the future?
Same argument around AsDate and AsDateOnly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gathogojr This is updated with this commit b25d32e
|
@WanjohiSammy The base for your pull request should be https://github.com/OData/ModelBuilder/tree/dev-3.x not main |
| <!-- For NuGet Package Dependencies --> | ||
| <PropertyGroup> | ||
| <ODataLibPackageDependency>[8.0.0, 9.0.0)</ODataLibPackageDependency> | ||
| <ODataLibPackageDependency>[9.0.0-preview.3, 10.0.0)</ODataLibPackageDependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious if this works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gathogojr This should work. It ensures the package uses ODL ≥ 9.0.0-preview.3 and < 10.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could bump the version in a different PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WanjohiSammy I think the version is fine. What I was curious about is whether the part -preview.3 is evaluated as expected
2134623 to
5ef0fa8
Compare
| branches: | ||
| include: | ||
| - main | ||
| - release-1.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add dev-3.x rather replace release-1.x, just in case one was to create a pull request against the release-1.x branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is updated through commit 43762ce
| displayName: midnightly build | ||
| branches: | ||
| include: | ||
| - main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add dev-3.x here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have dev-3.x here as well. Updated with commit 43762ce
Issues
This pull request fixes issue #xxx.
Description
This PR updates Microsoft.OData.ModelBuilder to version 3.0.0-preview.1, targeting .NET 10 and OData Library 9.0.0-preview.3.
Changes
Version & Framework Updates
net8.0tonet10.0Breaking Changes
DateOnlyandTimeOnlytypesDateandTimeOfDaytype mappings fromEdmLibHelpersProperty()overloads forTimeOfDayandDatetypes fromStructuralTypeConfiguration<T>IsDateOnly()to use direct type comparison instead of string-based lookupNew Features
AsTimeOnly()extension method forPrimitivePropertyConfiguration(complements existingAsTimeOfDay())IsTimeOnly()helper method inTypeHelperMustBeTimeOnlyPropertyfor validationUpdates & Fixes
ColumnAttributeEdmPropertyConventionto useAsTimeOnly()for time column typesCsdlTarget.ODataparameter)Testing
DateOnly/TimeOnlyinstead ofDate/TimeOfDayRelated Issues
This update aligns with the OData ecosystem's migration to .NET 10 and OData Library 9.x.
Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.