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

SaveChanges: Database.SetCommandTimeout overload that accepts a TimeSpan argument #6614

Closed
MicahZoltu opened this issue Sep 27, 2016 · 4 comments
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@MicahZoltu
Copy link
Contributor

MicahZoltu commented Sep 27, 2016

Int32 is ambiguous (milliseconds, seconds, minutes?) and shouldn't be used as a type when you really want a duration. Instead, TimeSpan should be used.

https://github.com/aspnet/EntityFramework/blob/master/src/Microsoft.EntityFrameworkCore.Relational/RelationalDatabaseFacadeExtensions.cs#L156

I don't mind submitting a PR for this, though I'm not sure what the proper deprecation strategy is for this project. Create an overload and somehow annotate the old one? Leave the old one and new one side-by-side (personally not a fan of this one)? A doc comment on the old one indicating it is deprecated? Delete the old one and accept the breaking change?

https://github.com/aspnet/EntityFramework/blob/master/src/Microsoft.EntityFrameworkCore.Relational/RelationalDatabaseFacadeExtensions.cs#L159 should similarly return a TimeSpan, not an Int32.

@rowanmiller
Copy link
Contributor

Hey,

We'd be happy to take a PR that adds an overload that takes TimeSpan. Specifying timeout in int is how this is handled in ADO.NET - which is why we have that API. But we agree that having the ability to specify in TimeSpan would make code clearer.

~Rowan

@divega
Copy link
Contributor

divega commented Oct 4, 2016

I think XML docs could help here.

@rowanmiller
Copy link
Contributor

Agreed, this is one of the parts of the product that hasn't been doc'd yet

@rowanmiller
Copy link
Contributor

Closing this out as we aren't planning to make the change, but feel free to send a PR for it

@smitpatel smitpatel added this to the 1.2.0 milestone Nov 16, 2016
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Nov 16, 2016
@ajcvickers ajcvickers changed the title Database.SetCommandTimeout should take a TimeSpan, not an Int32 API: Database.SetCommandTimeout should take a TimeSpan, not an Int32 May 9, 2017
@ajcvickers ajcvickers changed the title API: Database.SetCommandTimeout should take a TimeSpan, not an Int32 SaveChanges: Database.SetCommandTimeout should take a TimeSpan, not an Int32 May 9, 2017
@divega divega changed the title SaveChanges: Database.SetCommandTimeout should take a TimeSpan, not an Int32 SaveChanges: Database.SetCommandTimeout accepts a TimeSpan argument May 10, 2017
@divega divega changed the title SaveChanges: Database.SetCommandTimeout accepts a TimeSpan argument SaveChanges: Database.SetCommandTimeout overload that accepts a TimeSpan argument May 10, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

5 participants