@@ -37,14 +37,17 @@ public Func<IClient, CreateOrUpdateAsyncParams<TModel>, Task<TModel>> CreateOrUp
37
37
38
38
public Func < TModel , int > CreateTime { get ; }
39
39
40
+ public bool CompulsoryLocation { get ; }
41
+
40
42
public ResourceStrategy (
41
43
string type ,
42
44
Func < string , IEnumerable < string > > getId ,
43
45
Func < IClient , GetAsyncParams , Task < TModel > > getAsync ,
44
46
Func < IClient , CreateOrUpdateAsyncParams < TModel > , Task < TModel > > createOrUpdateAsync ,
45
47
Func < TModel , string > getLocation ,
46
48
Action < TModel , string > setLocation ,
47
- Func < TModel , int > createTime )
49
+ Func < TModel , int > createTime ,
50
+ bool compulsoryLocation )
48
51
{
49
52
Type = type ;
50
53
GetId = getId ;
@@ -53,6 +56,7 @@ public ResourceStrategy(
53
56
GetLocation = getLocation ;
54
57
SetLocation = setLocation ;
55
58
CreateTime = createTime ;
59
+ CompulsoryLocation = compulsoryLocation ;
56
60
}
57
61
}
58
62
@@ -66,7 +70,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
66
70
Func < TOperation , CreateOrUpdateAsyncParams < TModel > , Task < TModel > > createOrUpdateAsync ,
67
71
Func < TModel , string > getLocation ,
68
72
Action < TModel , string > setLocation ,
69
- Func < TModel , int > createTime )
73
+ Func < TModel , int > createTime ,
74
+ bool compulsoryLocation )
70
75
where TClient : ServiceClient < TClient >
71
76
{
72
77
Func < IClient , TOperation > toOperations = client => getOperations ( client . GetClient < TClient > ( ) ) ;
@@ -77,7 +82,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
77
82
( client , p ) => createOrUpdateAsync ( toOperations ( client ) , p ) ,
78
83
getLocation ,
79
84
setLocation ,
80
- createTime ) ;
85
+ createTime ,
86
+ compulsoryLocation ) ;
81
87
}
82
88
83
89
public static ResourceStrategy < TModel > Create < TModel , TClient , TOperation > (
@@ -88,7 +94,8 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
88
94
Func < TOperation , CreateOrUpdateAsyncParams < TModel > , Task < TModel > > createOrUpdateAsync ,
89
95
Func < TModel , string > getLocation ,
90
96
Action < TModel , string > setLocation ,
91
- Func < TModel , int > createTime )
97
+ Func < TModel , int > createTime ,
98
+ bool compulsoryLocation )
92
99
where TClient : ServiceClient < TClient >
93
100
=> Create (
94
101
type ,
@@ -98,6 +105,7 @@ public static ResourceStrategy<TModel> Create<TModel, TClient, TOperation>(
98
105
createOrUpdateAsync ,
99
106
getLocation ,
100
107
setLocation ,
101
- createTime ) ;
108
+ createTime ,
109
+ compulsoryLocation ) ;
102
110
}
103
111
}
0 commit comments