public static void Register() { //Fire-up SignalR SignalRExtensionConfig.Initialize(); // Use this class to set configuration options for your mobile service ConfigOptions options = new ConfigOptions(); //Allow only users to use our SignalR-Hub options.SetRealtimeAuthorization(AuthorizationLevel.User); ConfigBuilder builder = new ConfigBuilder(options, (httpConfig, autofac) => { autofac.RegisterInstance(new TableLoggingService()).As <ILoggingService>(); }); // Use this class to set WebAPI configuration options HttpConfiguration config = ServiceConfig.Initialize(builder); //Just a sample, on how to set the required options to get rid //of some of the sample page error-messages. //You can read more here: http://blogs.msdn.com/b/yaohuang1/archive/2012/10/13/asp-net-web-api-help-page-part-2-providing-custom-samples-on-the-help-page.aspx config.SetSampleForType( "Currently not used.", new MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(OldSchoolArtist)); //YOU CAN USE THE RESOURCE BROKER AFTER THE ASSEMBLIES FOR //THE MANAGED BACKEND USE THE LATEST WEB-API ASSEMBLIES //This is directly taken from the documenation about resource //Controllers on GitHub (created by the Azure Mobile Services Team) //https://github.com/Azure/azure-mobile-services-resourcebroker // Create a custom route mapping the resource type into the URI. //var resourcesRoute = config.Routes.CreateRoute( // routeTemplate: "api/resources/{type}", // defaults: new { controller = "resources" }, // constraints: null); // Insert the ResourcesController route at the top of the collection to avoid conflicting with predefined routes. //config.Routes.Insert(0, "Resources", resourcesRoute); // 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; Database.SetInitializer(new OldSchoolBeatsInitializer()); //trigger migrations manually //var migrator = new DbMigrator(new Configuration()); //migrator.Update(); }
public static void Register() { // Use this class to set configuration options for your mobile service ConfigOptions options = new ConfigOptions(); SignalRExtensionConfig.Initialize(); // Use this class to set WebAPI configuration options HttpConfiguration 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; }
public static void Register() { // Use this class to set configuration options for your mobile service ConfigOptions options = new ConfigOptions(); options.PushAuthorization = Microsoft.WindowsAzure.Mobile.Service.Security.AuthorizationLevel.User; var configBuilder = new ConfigBuilder(options, (httpconfig, ioc) => { ioc.RegisterInstance(new CORSSignalROwinAppBuilderExtension(httpconfig)).As <IOwinAppBuilderExtension>(); }); //Config Setting for Accessible Web Client //options.CorsPolicy = new System.Web.Http.Cors.EnableCorsAttribute("http://strandd.azurewebsites.net, http://strandd-dev.azurewebsites.net", "*", "*"); //config.EnableCors(options.CorsPolicy); // Use this class to set WebAPI configuration options HttpConfiguration config = ServiceConfig.Initialize(configBuilder); // 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.MapHttpAttributeRoutes(); // Initialize SignalR //var idProvider = new ZumoIUserProvider(); //GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => idProvider ); SignalRExtensionConfig.Initialize(); //EF DB-Migrator var migrator = new DbMigrator(new Configuration()); migrator.Update(); //This is for full Scema Drop DB Init [unused] //Database.SetInitializer(new stranddInitializer()); //This tells the local mobile service project to run as if it is being hosted in Azure, including honoring the AuthorizeLevel settings. config.SetIsHosted(true); }
public static void Register() { // Use this class to set configuration options for your mobile service ConfigOptions options = new ConfigOptions(); // Use this class to set WebAPI configuration options HttpConfiguration 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; // Set default and null value handling to "Include" for Json Serializer config.Formatters.JsonFormatter.SerializerSettings.DefaultValueHandling = Newtonsoft.Json.DefaultValueHandling.Include; config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Include; Database.SetInitializer(new demosignalrInitializer()); SignalRExtensionConfig.Initialize(); }