User-1350042179 posted
Hi
I have a project and I see that the classes with these attributes load in the beginning of the app.
I would like to know the difference...
For instance..I have the code...
[assembly: OwinStartup(typeof(Centenario.Proy.Service.Rest.MainContext.Startup))]
namespace Centenario.Proy.Service.Rest.MainContext
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var httpConfig = new HttpConfiguration();
var cors = new EnableCorsAttribute("*", "*", "*");
InitializeContainer.Start(httpConfig);
httpConfig.EnableCors(cors);
SignalRConfig.Register(app, cors);
WebApiConfig.Register(httpConfig);
RouteConfig.RegisterRoutes(RouteTable.Routes);
app.UseWebApi(httpConfig);
/***********21/05/2019**********************/
//var config = new HubConfiguration();
//config.EnableJSONP = true;
//app.UseCors(CorsOptions.AllowAll);
//app.MapSignalR(config);
/******************************/
// Any connection or hub wire up and configuration should go here
//app.MapSignalR();
}
}
And the code,,,
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]
namespace Centenario.Proy.Service.Rest.MainContext
{
public class SwaggerConfig
{
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
// By default, the service root url is inferred from the request used to access the docs.
// However, there may be situations (e.g. proxy and load-balanced environments) where this does not
// resolve correctly.