public MetadataRequestField(SdkMessageRequestField field)
 {
     Index = field.Index;
     Name = field.Name;
     CLRFormatter = field.CLRFormatter;
     IsOptional = field.IsOptional;
 }
Example #2
0
 internal void Fill(Result result)
 {
     if (result.SdkMessageRequestFieldPosition.HasValue)
     {
         if (!RequestFields.ContainsKey(result.SdkMessageRequestFieldPosition.Value))
         {
             var field = new SdkMessageRequestField(this, result.SdkMessageRequestFieldPosition.Value, result.SdkMessageRequestFieldName, result.SdkMessageRequestFieldClrParser, result.SdkMessageRequestFieldIsOptional);
             RequestFields.Add(result.SdkMessageRequestFieldPosition.Value, field);
         }
     }
 }
Example #3
0
 public String GetNameForRequestField(
     SdkMessageRequest request, SdkMessageRequestField requestField,
     IServiceProvider services)
 {
     return DefaultNamingService.GetNameForRequestField(
         request, requestField, services);
 }
Example #4
0
 static CodeAssignStatement BuildRequestFieldSetStatement(SdkMessageRequestField field)
 {
     return AssignValue(PropertyIndexer(ParametersPropertyName, field.Name));
 }
Example #5
0
 static CodeStatement BuildRequestFieldGetStatement(SdkMessageRequestField field, CodeTypeReference targetType)
 {
     return If(ContainsParameter(field.Name), Return(Cast(targetType, PropertyIndexer(ParametersPropertyName, field.Name))), Return(new CodeDefaultValueExpression(targetType)));
 }
Example #6
0
 static CodeMemberProperty BuildRequestField(SdkMessageRequest request, SdkMessageRequestField field, ServiceProvider serviceProvider)
 {
     Trace.TraceInformation("Entering {0}", new object[] {MethodBase.GetCurrentMethod().Name});
     var typeForRequestField = serviceProvider.TypeMappingService.GetTypeForRequestField(field, serviceProvider);
     var property = PropertyGet(typeForRequestField, serviceProvider.NamingService.GetNameForRequestField(request, field, serviceProvider), new CodeStatement[0]);
     property.HasSet = true;
     property.HasGet = true;
     property.GetStatements.Add(BuildRequestFieldGetStatement(field, typeForRequestField));
     property.SetStatements.Add(BuildRequestFieldSetStatement(field));
     Trace.TraceInformation("Exiting {0}: {1}.Request Property {2} defined", new object[] {MethodBase.GetCurrentMethod().Name, request.Name, property.Name});
     return property;
 }
Example #7
0
 CodeGenerationType ICodeGenerationService.GetTypeForRequestField(SdkMessageRequest request, SdkMessageRequestField requestField, IServiceProvider services)
 {
     return CodeGenerationType.Property;
 }
Example #8
0
 string INamingService.GetNameForRequestField(SdkMessageRequest request, SdkMessageRequestField requestField, IServiceProvider services)
 {
     if (_knowNames.ContainsKey(request.Id.ToString() + requestField.Index.ToString(CultureInfo.InvariantCulture)))
     {
         return _knowNames[request.Id.ToString() + requestField.Index.ToString(CultureInfo.InvariantCulture)];
     }
     var str = CreateValidName(requestField.Name);
     _knowNames.Add(request.Id.ToString() + requestField.Index.ToString(CultureInfo.InvariantCulture), str);
     return str;
 }
 public CodeGenerationType GetTypeForRequestField(SdkMessageRequest request, SdkMessageRequestField requestField, IServiceProvider services)
 {
     return GetTypeForRequestFieldInternal(request, requestField, services);
 }
 protected virtual CodeGenerationType GetTypeForRequestFieldInternal(SdkMessageRequest request, SdkMessageRequestField requestField, IServiceProvider services)
 {
     return _defaultService.GetTypeForRequestField(request, requestField, services);
 }
Example #11
0
 CodeTypeReference ITypeMappingService.GetTypeForRequestField(SdkMessageRequestField requestField, IServiceProvider services)
 {
     return GetTypeForField(requestField.CLRFormatter, requestField.IsGeneric);
 }
Example #12
0
 public string GetNameForRequestField(SdkMessageRequest request, Microsoft.Crm.Services.Utility.SdkMessageRequestField requestField, IServiceProvider services)
 {
     return(DefaultNamingService.GetNameForRequestField(request, requestField, services));
 }