예제 #1
0
        public static void Register()
        {
            // Use this class to set configuration options for your mobile service
            var options = new ConfigOptions();

            options.LoginProviders.Remove(typeof(AzureActiveDirectoryLoginProvider));
            options.LoginProviders.Add(typeof(AzureActiveDirectoryExtendedLoginProvider));
            options.LoginProviders.Add(typeof(FBLoginProvider));
            options.LoginProviders.Add(typeof(VKLoginProvider));
            // Use this class to set WebAPI configuration options
            var config = ServiceConfig.Initialize(new ConfigBuilder(options));

            // To display errors in the browser during development, uncomment the following
            // line. Comment it out again when you deploy your service for production use.
            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            config.Formatters.JsonFormatter.SerializerSettings.DefaultValueHandling       = DefaultValueHandling.Include;
            config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling          = NullValueHandling.Include;
            config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling      = ReferenceLoopHandling.Serialize;
            config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling =
                PreserveReferencesHandling.Objects;
            config.MessageHandlers.Add(new ThrottlingHandler
            {
                Policy = new ThrottlePolicy(5)
                {
                    IpThrottling = true
                },
                Repository = new CacheRepository()
            });
            Mapper.Initialize(cfg => { DTOMapper.CreateMapping(cfg); });

            //var migrator = new DbMigrator(new Configuration());
            // migrator.Update();
            //  Database.SetInitializer(new appartmenthostInitializer());
        }