Skip to content

Commit 0ac3812

Browse files
author
Peter Nied
committed
Merge pull request #7 from kevklam/master
Add Edm.Date support
2 parents 7d56bab + 9651b96 commit 0ac3812

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

Templates/ObjC/Base/SharedObjC.template.tt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ private string GetJsonToObjCExpressionConversion(string expr,OdcmProperty prop)
9797
{
9898
// This generates a wrapper around a provided JSON-typed expression (i.e. types obtained from NSJSONSerialization)
9999
// that converts it to a user-friendly ObjC type i.e. generated Entity/enum class etc.
100-
if(GetObjCTypeIdentifier(prop,true)=="NSDate")
100+
if(GetObjCTypeIdentifier(prop,true)=="NSDate" ||
101+
GetObjCTypeIdentifier(prop,true)=="MSDate")
101102
{
102-
return String.Format(@"[NSDate ms_dateFromString: {0}]",expr);
103+
return String.Format(@"[{0} ms_dateFromString: {1}]",
104+
GetObjCTypeIdentifier(prop,true),
105+
expr);
103106
}
104107

105108
if(prop.IsEnum())

Templates/ObjC/Models/Models.h.tt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,31 @@
11
<# // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. #>
22
<#@ template debug="true" hostspecific="true" language="C#" #>
33
<#@ include file="SharedObjC.template.tt"#>
4-
<#
5-
6-
var enums = model.GetEnumTypes();
74

5+
#import "MSDate.h"
6+
<#
7+
var enums = model.GetEnumTypes();
88
foreach(var e in enums)
99
{
10-
1110
#>
1211
#import "<#=writer.GetPrefix() + e.Name.ToUpperFirstChar()#>.h"
1312
<#
14-
1513
}
1614

1715
var complexTypes = model.GetComplexTypes().Where(complexType => !complexType.LongDescriptionContains("methodResponse"));
18-
1916
foreach(var c in complexTypes)
2017
{
21-
2218
#>
2319
#import "<#=writer.GetPrefix() + c.Name.ToUpperFirstChar()#>.h"
2420
<#
25-
2621
}
2722

2823
var entityTypes = model.GetEntityTypes();
29-
3024
foreach(var et in entityTypes)
31-
{
32-
25+
{
3326
#>
3427
#import "<#=writer.GetPrefix() + et.Name.ToUpperFirstChar()#>.h"
3528
<#
36-
3729
}
3830

3931
#>

src/GraphODataTemplateWriter/CodeHelpers/ObjC/TypeHelperObjC.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ public static string GetTypeString(this OdcmType type)
105105
case "Float":
106106
return "CGFloat";
107107
case "DateTimeOffset":
108-
case "Date":
109108
return "NSDate";
109+
case "Date":
110+
return "MSDate";
110111
case "Binary":
111112
return "NSString";
112113
case "Boolean":

0 commit comments

Comments
 (0)