예제 #1
0
    /// <summary>
    /// Gets the type code.
    /// </summary>
    /// <param name="service">The service.</param>
    /// <param name="dictionaryObject">The dictionary object.</param>
    /// <param name="dictionaryObjectType">Type of the dictionary object.</param>
    /// <param name="valueAsString">The value as string.</param>
    /* private */ static void GetTypeCode(ExchangeServiceBase service, object dictionaryObject, ref UserConfigurationDictionaryObjectType dictionaryObjectType, ref String valueAsString)
    {
        // Handle all other types by TypeCode
        switch (Type.GetTypeCode(dictionaryObject.GetType()))
        {
        case TypeCode.Boolean:
            dictionaryObjectType = UserConfigurationDictionaryObjectType.Boolean;
            valueAsString        = EwsUtilities.BoolToXSBool((bool)dictionaryObject);
            break;

        case TypeCode.Byte:
            dictionaryObjectType = UserConfigurationDictionaryObjectType.Byte;
            valueAsString        = ((byte)dictionaryObject).ToString();
            break;

        case TypeCode.DateTime:
            dictionaryObjectType = UserConfigurationDictionaryObjectType.DateTime;
            valueAsString        = service.ConvertDateTimeToUniversalDateTimeString((DateTime)dictionaryObject);
            break;

        case TypeCode.Int32:
            dictionaryObjectType = UserConfigurationDictionaryObjectType.Integer32;
            valueAsString        = ((int)dictionaryObject).ToString();
            break;

        case TypeCode.Int64:
            dictionaryObjectType = UserConfigurationDictionaryObjectType.Integer64;
            valueAsString        = ((long)dictionaryObject).ToString();
            break;

        case TypeCode.String:
            dictionaryObjectType = UserConfigurationDictionaryObjectType.String;
            valueAsString        = (string)dictionaryObject;
            break;

        case TypeCode.UInt32:
            dictionaryObjectType = UserConfigurationDictionaryObjectType.UnsignedInteger32;
            valueAsString        = ((uint)dictionaryObject).ToString();
            break;

        case TypeCode.UInt64:
            dictionaryObjectType = UserConfigurationDictionaryObjectType.UnsignedInteger64;
            valueAsString        = ((ulong)dictionaryObject).ToString();
            break;

        default:
            EwsUtilities.Assert(
                false,
                "UserConfigurationDictionary.WriteObjectValueToXml",
                "Unsupported type: " + dictionaryObject.GetType().ToString());
            break;
        }
    }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DirectoryHelper"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 public DirectoryHelper(ExchangeServiceBase service)
 {
     this.service = service;
 }
예제 #3
0
 /// <summary>Register service method implementations with a service binder. Useful when customizing the service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, ExchangeServiceBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_GetTokenInfo, serviceImpl.GetTokenInfo);
     serviceBinder.AddMethod(__Method_Ping, serviceImpl.Ping);
 }
예제 #4
0
        public static bool IsServiceTesting(ExchangeServiceBase service)
        {
            return(true);

            return(ServicesToTest.Any(s => s.IsServiceTesting(service)));
        }
예제 #5
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(ExchangeServiceBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_GetTokenInfo, serviceImpl.GetTokenInfo)
            .AddMethod(__Method_Ping, serviceImpl.Ping).Build());
 }