@@ -119,6 +119,20 @@ public string GetCollectionReferencesRequestBuilder(OdcmProperty odcmProperty)
119119// Creates the indexer property definition for a standard navigation collection
120120public string GetCollectionIndexRequestBuilder(OdcmProperty odcmProperty)
121121{
122+ // In case there is an action or function with the name of item. This is to avoid CS0102
123+ // https://msdn.microsoft.com/en-US/library/26f2y168%28v=VS.90%29.aspx
124+ var allMethods = new List<OdcmMethod>();
125+ foreach (var method in odcmProperty.Projection.Type.AsOdcmClass().Methods)
126+ {
127+ allMethods.Add(method);
128+ allMethods.AddRange(method.Overloads);
129+ }
130+ var renameItem = "";
131+ if (allMethods.Exists(x => x.Name.Equals("item")))
132+ {
133+ renameItem = " [System.Runtime.CompilerServices.IndexerName(\"ThisItem\")]";
134+ }
135+
122136 var stringBuilder = new StringBuilder();
123137 var propTypeName = string.Concat(this.GetEntityNameString(odcmProperty.Class), this.GetPropertyTypeName(odcmProperty));
124138 var entityRequestBuilder = this.GetPropertyTypeRequestBuilderName(odcmProperty);
@@ -133,6 +147,11 @@ public string GetCollectionIndexRequestBuilder(OdcmProperty odcmProperty)
133147 stringBuilder.Append(Environment.NewLine);
134148 stringBuilder.AppendFormat(" /// <returns>The <see cref=\"I{0}\"/>.</returns>", entityRequestBuilder);
135149 stringBuilder.Append(Environment.NewLine);
150+ if (renameItem.Length > 0)
151+ {
152+ stringBuilder.Append(renameItem);
153+ stringBuilder.Append(Environment.NewLine);
154+ }
136155 stringBuilder.AppendFormat(" public I{0} this[string id]", entityRequestBuilder);
137156 stringBuilder.Append(Environment.NewLine);
138157 stringBuilder.Append(
0 commit comments