Skip to content

Commit c36d41f

Browse files
authored
Merge pull request #27 from microsoftgraph/shiftylogic/working
Fixing a bug introduced in the last set of changes plus fixing a few …
2 parents 8f1189e + f0625e0 commit c36d41f

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

Templates/CSharp/Requests/MethodRequestBuilder.cs.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var methods = overloads
5353

5454
#>
5555

56-
namespace Microsoft.Graph
56+
namespace <#=method.Namespace.GetNamespaceName()#>
5757
{
5858
using System;
5959
using System.Collections.Generic;

src/GraphODataTemplateWriter/CodeHelpers/ObjC/CodeWriterObjC.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ public override string WriteOpeningCommentLine()
3636
return "";
3737
}
3838

39-
public override string WriteClosingCommentLine()
39+
public override string WriteClosingCommentLine()
4040
{
4141
return this.NewLineCharacter;
4242
}
4343

44-
public override string WriteInlineCommentChar()
44+
public override string WriteInlineCommentChar()
4545
{
4646
return "// ";
4747
}
4848

49-
public string GetInterfaceLine(OdcmClass entityType, string baseClass = null)
49+
public string GetInterfaceLine(OdcmClass entityType, string baseClass = null)
5050
{
5151
string baseEntity = null;
5252
if (baseClass != null)
@@ -59,7 +59,7 @@ public string GetInterfaceLine(OdcmClass entityType, string baseClass = null)
5959
: this.GetPrefix() + entityType.Base.Name.Substring(entityType.Base.Name.LastIndexOf(".") + 1);
6060
}
6161
var interfaceLineBuilder = new StringBuilder();
62-
// NSObject lives in Foundation/Foundation.h
62+
// NSObject lives in Foundation/Foundation.h
6363
var baseImport = (baseEntity.Equals("NSObject")) ? "#import <Foundation/Foundation.h>" : String.Format("#import \"{0}.h\"", baseEntity);
6464
interfaceLineBuilder.AppendLine(baseImport);
6565

@@ -69,7 +69,7 @@ public string GetInterfaceLine(OdcmClass entityType, string baseClass = null)
6969
return interfaceLineBuilder.ToString();
7070
}
7171

72-
public string GetHeaderDoc(string name)
72+
public string GetHeaderDoc(string name)
7373
{
7474

7575
var stringBuilder = new StringBuilder();
@@ -80,7 +80,7 @@ public string GetHeaderDoc(string name)
8080
return stringBuilder.ToString();
8181
}
8282

83-
public string GetImplementationDoc(string name)
83+
public string GetImplementationDoc(string name)
8484
{
8585
var stringBuilder = new StringBuilder();
8686
stringBuilder.Append(@"/**");
@@ -90,16 +90,16 @@ public string GetImplementationDoc(string name)
9090
return stringBuilder.ToString();
9191
}
9292

93-
public string GetMethodDoc(string name, List<OdcmProperty> parameters)
93+
public string GetMethodDoc(string name, List<OdcmProperty> parameters)
9494
{
9595
return "";
9696
}
97-
98-
public string GetParamsForRaw(IEnumerable<string> parameters)
97+
98+
public string GetParamsForRaw(IEnumerable<string> parameters)
9999
{
100100
string param = "With";
101101

102-
foreach (var p in parameters)
102+
foreach (var p in parameters)
103103
{
104104
param += param == "With" ? string.Format("{0}:(NSString *) {1} ", char.ToUpper(p[0]) + p.Substring(1), p.ToLowerFirstChar()) :
105105
string.Format("{0}:(NSString *) {0} ", p.ToLowerFirstChar());
@@ -110,12 +110,12 @@ public string GetParamsForRaw(IEnumerable<string> parameters)
110110
return param;
111111
}
112112

113-
public string GetParamRaw(string type)
113+
public string GetParamRaw(string type)
114114
{
115115
return "NSString *" + type.ToLowerFirstChar();
116116
}
117117

118-
public string GetImportsClass(IEnumerable<OdcmProperty> references, IEnumerable<string> extraImports = null, IEnumerable<string> extraClasses = null)
118+
public string GetImportsClass(IEnumerable<OdcmProperty> references, IEnumerable<string> extraImports = null, IEnumerable<string> extraClasses = null)
119119
{
120120
if (references != null && references.Any())
121121
{
@@ -173,7 +173,7 @@ public string GetImportsClass(IEnumerable<OdcmProperty> references, IEnumerable<
173173
return "";
174174
}
175175

176-
public string GetParametersToJsonRaw(IEnumerable<string> parameters)
176+
public string GetParametersToJsonRaw(IEnumerable<string> parameters)
177177
{
178178
if (!parameters.Any()) { return new StringBuilder().AppendLine().ToString(); }
179179

@@ -260,7 +260,7 @@ public string GetParamsString(IEnumerable<OdcmParameter> parameters)
260260
else
261261
{
262262
param += string.Format("{0}:({1}){2}", paramName, p.Type.GetFullType(), p.Name.ToLowerFirstChar());
263-
}
263+
}
264264
}
265265
param += " ";
266266
}
@@ -326,7 +326,7 @@ public string GetGetterString(string propertyName)
326326
{
327327
//Fixes names that violate semantic rules for methods that
328328
//create owned objects
329-
329+
330330
if(SemanticOwnedObjectsKeywords.Any(x => propertyName.StartsWith(x,StringComparison.OrdinalIgnoreCase)))
331331
{
332332
return "get" + propertyName.ToPascalize();
@@ -338,7 +338,6 @@ public string GetGetterString(string propertyName)
338338
public string GetPropertyDeclaration(string propertyName, string type)
339339
{
340340
var getterName = this.GetGetterString(propertyName);
341-
var setterName = "set" + propertyName.ToPascalize();
342341

343342
return "@property (nonatomic, getter=" + getterName + ") " + type + " " + propertyName + ";";
344343
}

src/GraphODataTemplateWriter/Extensions/OdcmModelExtensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static OdcmProperty GetServiceCollectionNavigationPropertyForPropertyType
137137
// Try to find the first collection navigation property for the specified type directly on the service
138138
// class object. Use First() instead of FirstOrDefault() so template generation would fail if not found
139139
// instead of silently continuing. If an entity is used in a reference property a navigation collection
140-
// on the client for that type is required.
140+
// on the client for that type is required.
141141
return odcmProperty
142142
.Class
143143
.Namespace
@@ -198,8 +198,6 @@ public static OdcmClass AsOdcmClass(this OdcmObject odcmObject)
198198

199199
public static OdcmEnum AsOdcmEnum(this OdcmObject odcmObject)
200200
{
201-
OdcmEnum foo = odcmObject as OdcmEnum;
202-
var bar = foo.Members.LastOrDefault();
203201
return odcmObject as OdcmEnum;
204202
}
205203

src/GraphODataTemplateWriter/TemplateProcessor/TemplateWriter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ private string PathWriterClassNameFormatString
3333
private void SetTemplatesDirectory(string templatesDirectory, bool relative = true)
3434
{
3535
string programDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
36-
string relativeTemplatesDirectory = templatesDirectory ?? "Templates";
3736

3837
this.TemplatesDirectory = (relative) ? Path.Combine(programDir, templatesDirectory) : templatesDirectory;
3938

0 commit comments

Comments
 (0)