EntityFramework.ApiDocs icon indicating copy to clipboard operation
EntityFramework.ApiDocs copied to clipboard

SaveChangesAsync() doc page

Open ajcvickers opened this issue 7 years ago • 4 comments

Moved from https://github.com/aspnet/EntityFrameworkCore/issues/12751 posted by @erictrigo

Check out: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.savechangesasync?view=efcore-2.1

Says signature for SaveChangesAsync is

public virtual System.Threading.Tasks.Task<int> SaveChangesAsync (System.Threading.CancellationToken cancellationToken = null);

If you try overriding SaveChangesAsync using the above example, it'll give you the following error:

image

Using default(CancellationToken) instead of null solves the issue: public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken))

ajcvickers avatar Jul 30 '18 17:07 ajcvickers

From @smitpatel

Looks like issue in docs gen https://github.com/aspnet/EntityFrameworkCore/blob/df9d2ccb47614b014c11903ed0eb8c9830da1d2c/src/EFCore/DbContext.cs#L491-L492

cc:@divega

ajcvickers avatar Jul 30 '18 17:07 ajcvickers

@dend do you know if this is a general issue with the way the cancellationToken = default pattern gets rendered when the API ref docs are generated?

BTW, I tried to verify if this was happening on other APIs but all the new 2.1 APIs that happen to use this pattern seem to be missing from the .NET API Browser. E.g. https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.gzipstream.writeasync?view=netcore-2.1 is missing this overload:

public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
{ }

cc: @mairaw

divega avatar Aug 02 '18 02:08 divega

I see the same behavior on apisof.net (/cc @terrajobst) https://apisof.net/catalog/System.IO.Compression.GZipStream.WriteAsync(Byte(),Int32,Int32,CancellationToken)

Not sure if you can infer the default from reflection to be able to build the signature exactly (can't look right now)

Probably it would be best to open an issue at https://github.com/mono/api-doc-tools/ for @joelmartinez to investigate

mairaw avatar Aug 02 '18 06:08 mairaw

Our index hasn't been updated in a while (see below). We need to make some infrastructure changes and that's coming online later. image So it's possible that apisof.net is out-of-date. Not sure why that problem would apply to the docs though...

terrajobst avatar Aug 02 '18 20:08 terrajobst