コード例 #1
0
		static void AddODataSupport( ServerHost server )
		{
			var objectModelBuilder = new ODataConventionModelBuilder();

			var bornInfo = objectModelBuilder.ComplexType<BornInfoView>();
			
			bornInfo.Property( bi => bi.When );
			bornInfo.Property( bi => bi.Where );

			var person = objectModelBuilder.EntitySet<PersonView>( "PeopleView" )
				.EntityType.HasKey( p => p.Id );

			person.Property( p => p.Name );
			person.Property( p => p.Version );
			person.ComplexProperty( p => p.BornInfo );

			var address = objectModelBuilder.EntitySet<AddressView>( "AddressesView" )
				.EntityType.HasKey( a => a.AddressId );

			address.Property( a => a.Street );
			address.Property( a => a.PersonId );

			server.AddHttpConfigurationCustomization( cfg =>
			{
				cfg.MapODataServiceRoute(
						routeName: "ODataRoute",
						routePrefix: null,
						model: objectModelBuilder.GetEdmModel()
					);
			} );
		}
コード例 #2
0
		protected override void OnStop()
		{
			if( this._server == null )
			{
				return;
			}
			this._server.Stop();
			this._server = null;
		}
コード例 #3
0
		protected override void OnStart( string[] args )
		{
			var baseAddress = ConfigurationManager.AppSettings[ "owin/baseAddress" ];

			var bootstrapper = new WindsorBootstrapper( AppDomain.CurrentDomain.BaseDirectory );
			var windsor = bootstrapper.Boot();

			this._server = new ServerHost(
				baseAddress,
				bootstrapper.ProbeDirectory,
				windsor );

			AddODataSupport( this._server );
			AddSignalRSupport( this._server );

			this._server.Start();
		}
コード例 #4
0
		static void AddSignalRSupport( ServerHost server )
		{
			server.AddAppBuilderCustomization( appBuilder =>
			{
				appBuilder.UseCors( CorsOptions.AllowAll );
				appBuilder.MapSignalR();
			} );
		}