public static void InitApp(String applicationId, String apiKey) { if (String.IsNullOrEmpty(applicationId)) { throw new ArgumentNullException(ExceptionMessage.NULL_APPLICATION_ID); } if (String.IsNullOrEmpty(apiKey)) { throw new ArgumentNullException(ExceptionMessage.NULL_SECRET_KEY); } Log.addLogger(Log.DEFAULTLOGGER, new ConsoleLogger()); Log.startLogging(BACKENDLESSLOG); #if WITHRT Quobject.EngineIoClientDotNet.Modules.LogManager.Enabled = !DeviceCheck.IsMobile; #endif AppId = applicationId; APIKey = apiKey; 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(); #if WITHRT RT = new RTServiceImpl(); #endif MessageWriter.DefaultWriter = new UnderflowWriter(); MessageWriter.AddAdditionalTypeWriter(typeof(BackendlessUser), new BackendlessUserWriter()); MessageWriter.AddAdditionalTypeWriter(typeof(Geometry), new BackendlessGeometryWriter()); MessageWriter.AddAdditionalTypeWriter(typeof(Point), new BackendlessGeometryWriter()); MessageWriter.AddAdditionalTypeWriter(typeof(LineString), new BackendlessGeometryWriter()); MessageWriter.AddAdditionalTypeWriter(typeof(Polygon), new BackendlessGeometryWriter()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(BackendlessUser).FullName, new BackendlessUserFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(GeometryDTO).FullName, new BackendlessGeometryFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(Geometry).FullName, new BackendlessGeometryFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(Point).FullName, new BackendlessGeometryFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(LineString).FullName, new BackendlessGeometryFactory()); ORBConfig.GetInstance().getObjectFactories().AddArgumentObjectFactory(typeof(Polygon).FullName, new BackendlessGeometryFactory()); HeadersManager.CleanHeaders(); LoginStorage loginStorage = new LoginStorage(); if (loginStorage.HasData) { HeadersManager.GetInstance().AddHeader(HeadersEnum.USER_TOKEN_KEY, loginStorage.UserToken); } }
public static void InitApp(string applicationId, string apiKey) { if (string.IsNullOrEmpty(applicationId)) { throw new ArgumentNullException(ExceptionMessage.NULL_APPLICATION_ID); } if (string.IsNullOrEmpty(apiKey)) { throw new ArgumentNullException(ExceptionMessage.NULL_SECRET_KEY); } AppId = applicationId; APIKey = apiKey; 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); } }
private ORBConfig() { instance = this; #if ( FULL_BUILD) Initialize(null); #endif #if (PURE_CLIENT_LIB || WINDOWS_PHONE8) getTypeMapper()._AddClientClassMapping("flex.messaging.messages.AsyncMessage", typeof(Weborb.V3Types.AsyncMessage)); getTypeMapper()._AddClientClassMapping("flex.messaging.messages.CommandMessage", typeof(Weborb.V3Types.CommandMessage)); getTypeMapper()._AddClientClassMapping("flex.messaging.messages.RemotingMessage", typeof(Weborb.V3Types.ReqMessage)); getTypeMapper()._AddClientClassMapping("flex.messaging.messages.AcknowledgeMessage", typeof(Weborb.V3Types.AckMessage)); getTypeMapper()._AddClientClassMapping("flex.messaging.messages.ErrorMessage", typeof(Weborb.V3Types.ErrMessage)); getTypeMapper()._AddClientClassMapping("flex.messaging.io.ObjectProxy", typeof(Weborb.Util.ObjectProxy)); getTypeMapper()._AddClientClassMapping("weborb.v3types.V3Message", typeof(Weborb.V3Types.V3Message)); IArgumentObjectFactory factory = (IArgumentObjectFactory)getObjectFactories()._CreateServiceObject("Weborb.V3Types.BodyHolderFactory"); getObjectFactories().AddArgumentObjectFactory("Weborb.V3Types.BodyHolder", factory); getTypeMapper()._AddAbstractTypeMapping(typeof(System.Collections.Generic.IList <>), typeof(System.Collections.Generic.List <>)); ITypeWriter writerObject = (ITypeWriter)getObjectFactories()._CreateServiceObject("Weborb.V3Types.BodyHolderWriter"); Type mappedType = typeof(Weborb.V3Types.BodyHolder); MessageWriter.AddAdditionalTypeWriter(mappedType, writerObject); #endif #if ( PURE_CLIENT_LIB ) getTypeMapper()._AddAbstractTypeMapping(typeof(System.Collections.ICollection), typeof(System.Collections.ArrayList)); getTypeMapper()._AddAbstractTypeMapping(typeof(System.Collections.IList), typeof(System.Collections.ArrayList)); getTypeMapper()._AddAbstractTypeMapping(typeof(System.Collections.IDictionary), typeof(System.Collections.Hashtable)); #endif #if ( WINDOWS_PHONE8 ) getTypeMapper()._AddAbstractTypeMapping(typeof(System.Collections.ICollection), typeof(System.Collections.Generic.List <>)); getTypeMapper()._AddAbstractTypeMapping(typeof(System.Collections.IList), typeof(System.Collections.Generic.List <>)); getTypeMapper()._AddAbstractTypeMapping(typeof(System.Collections.IDictionary), typeof(System.Collections.Generic.Dictionary <,>)); #endif }