Closed Kim-SSi closed 3 years ago
manually merged.
v1.10.1 released.
It might be worth setting the ArrayAsIEnumerableDerived enum values explicitly. That would make it easier to figure out what we should set ArrayAs to like ActionNameStrategy.
Array is preferred as the default, since this looks more consistent with what in TS codes. Though Microsoft recommends IEnumerable in general , however, in data serialization with DTO on the client side, IEnumerable does not seem to provide advantage over array.
/// <summary>
/// By default, array type will be array in generated C#. You may generated IEnumerable and some of its derived types.
/// </summary>
public ArrayAsIEnumerableDerived ArrayAs { get; set; }
public enum ArrayAsIEnumerableDerived
{
Array,
IEnumerable,
IList,
ICollection,
IReadOnlyList,
IReadOnlyCollection,
List,
Collection,
ReadOnlyCollection,
}
Microsoft best practices often recommend using IEnumerable. The preference of using Array in OpenApiClientGen and WebApiClientGen is more in line with what could be possibly generated for TypeScript. Depending on your own contexts, you may choose other forms of data collection.
Sorry that I was not clear enough. I meant explicitly setting the enum values. That way any additional values added in the future do no easily alter the value use in the setting.json.
public enum ArrayAsIEnumerableDerived
{
Array = 0,
IEnumerable = 1,
IList = 2,
ICollection = 3,
IReadOnlyList = 4,
IReadOnlyCollection = 5,
List = 6,
Collection = 7,
ReadOnlyCollection = 8,
}
I see. Thanks. Fixed that and the other one.
ArrayAs setting was being ignored for arrayRank = 1.