You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@KrzysztofCwalina pointed out in the ongoing API review that model types only ever returned shouldn't have public constructors. We're not generating those constructors, but C# will add a default public constructor if we don't have any. Here's an example comment.
We need to add an internal constructor that looks something like:
/// <summary>
/// Prevent direct instantiation of ${naming.type(type.name)} instances.
/// You can use ${factoryName}.${naming.type(type.name)} instead.
/// </summary>
internal ${naming.type(type.name)}() { }
This is a little more involved. You can see where we generate constructors at generator.ts line 872. We want to add an else that generates the above code. You can get the factory name for the helpful comment via same code as line 943. Adding a local variable for naming.type(type.name) probably wouldn't hurt either.
When you regenerate, you should see private constructors appear for all the model types without other constructors and a Azure.Storage.sln should rebuild cleanly.
The text was updated successfully, but these errors were encountered:
tg-msft
added
Storage
Storage Service (Queues, Blobs, Files)
Client
This issue points to a problem in the data-plane of the library.
labels
Sep 24, 2019
@KrzysztofCwalina pointed out in the ongoing API review that model types only ever returned shouldn't have public constructors. We're not generating those constructors, but C# will add a default public constructor if we don't have any. Here's an example comment.
We need to add an internal constructor that looks something like:
This is a little more involved. You can see where we generate constructors at generator.ts line 872. We want to add an
else
that generates the above code. You can get the factory name for the helpful comment via same code as line 943. Adding a local variable fornaming.type(type.name)
probably wouldn't hurt either.When you regenerate, you should see private constructors appear for all the model types without other constructors and a Azure.Storage.sln should rebuild cleanly.
The text was updated successfully, but these errors were encountered: