예제 #1
0
        public static void InitApp(string applicationId, string secretKey, string version)
        {
            if (string.IsNullOrEmpty(applicationId))
            {
                throw new ArgumentNullException(ExceptionMessage.NULL_APPLICATION_ID);
            }

            if (string.IsNullOrEmpty(secretKey))
            {
                throw new ArgumentNullException(ExceptionMessage.NULL_SECRET_KEY);
            }

            if (string.IsNullOrEmpty(version))
            {
                throw new ArgumentNullException(ExceptionMessage.NULL_VERSION);
            }

            AppId      = applicationId;
            SecretKey  = secretKey;
            VersionNum = version;

            Persistence = new PersistenceService();
            Data        = Persistence;
            Geo         = new BackendlessAPI.Service.GeoService();
            Messaging   = new BackendlessAPI.Service.MessagingService();
            Files       = new BackendlessAPI.Service.FileService();
            UserService = new BackendlessAPI.Service.UserService();
            Events      = BackendlessAPI.Events.GetInstance();
            Cache       = BackendlessAPI.Caching.Cache.GetInstance();
            Counters    = BackendlessAPI.Counters.CounterService.GetInstance();
            Logging     = new BackendlessAPI.Logging.LoggingService();

            HeadersManager.CleanHeaders();
        }
예제 #2
0
    public static void InitApp( string applicationId, string secretKey, string version )
    {
      if( string.IsNullOrEmpty( applicationId ) )
        throw new ArgumentNullException( ExceptionMessage.NULL_APPLICATION_ID );

      if( string.IsNullOrEmpty( secretKey ) )
        throw new ArgumentNullException(ExceptionMessage.NULL_SECRET_KEY);

      if( string.IsNullOrEmpty( version ) )
        throw new ArgumentNullException(ExceptionMessage.NULL_VERSION);

      AppId = applicationId;
      SecretKey = secretKey;
      VersionNum = version;

      Persistence = new PersistenceService();
      Data = Persistence;
      Geo = new GeoService();
      Messaging = new MessagingService();
      Files = new FileService();
      UserService = new UserService();
      Events = Events.GetInstance();
      Cache = Cache.GetInstance();
      Counters = CounterService.GetInstance();
      Logging = new LoggingService();
      CustomService = new CustomService();
      
      MessageWriter.DefaultWriter = new UnderflowWriter();
      MessageWriter.AddAdditionalTypeWriter( typeof( BackendlessUser ), new BackendlessUserWriter() );
      ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory( typeof( BackendlessUser ).FullName, new BackendlessUserFactory() );

      HeadersManager.CleanHeaders();
      LoginStorage loginStorage = new LoginStorage();

      if( loginStorage.HasData )
        HeadersManager.GetInstance().AddHeader( HeadersEnum.USER_TOKEN_KEY, loginStorage.UserToken );
    }
예제 #3
0
        public static void InitApp(string applicationId, string secretKey, string version)
        {
            if (string.IsNullOrEmpty(applicationId))
            throw new ArgumentNullException(ExceptionMessage.NULL_APPLICATION_ID);

              if (string.IsNullOrEmpty(secretKey))
            throw new ArgumentNullException(ExceptionMessage.NULL_SECRET_KEY);

              if (string.IsNullOrEmpty(version))
            throw new ArgumentNullException(ExceptionMessage.NULL_VERSION);

              AppId = applicationId;
              SecretKey = secretKey;
              VersionNum = version;

              Persistence = new PersistenceService();
              Data = Persistence;
              Geo = new BackendlessAPI.Service.GeoService();
              Messaging = new BackendlessAPI.Service.MessagingService();
              Files = new BackendlessAPI.Service.FileService();
              UserService = new BackendlessAPI.Service.UserService();
              Events = BackendlessAPI.Events.GetInstance();
              Cache = BackendlessAPI.Caching.Cache.GetInstance();
              Counters = BackendlessAPI.Counters.CounterService.GetInstance();
              Logging = new BackendlessAPI.Logging.LoggingService();

              HeadersManager.CleanHeaders();
        }