Exemple #1
0
        private static string TypeScriptType(Type type)
        {
            type = CleanMList(type);

            type = type.UnNullify().CleanType();

            return(BasicType(type) ?? ReflectionServer.GetTypeName(type) ?? "any");
        }
Exemple #2
0
        public static void Start(IApplicationBuilder app, IWebHostEnvironment hostingEnvironment, Assembly mainAsembly)
        {
            Schema.Current.ApplicationName = hostingEnvironment.ContentRootPath;

            SignumControllerFactory.RegisterArea(typeof(EntitiesController));
            SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod() !);

            ReflectionServer.Start();
        }
Exemple #3
0
        public static void Start(IApplicationBuilder app, IWebHostEnvironment hostingEnvironment, Assembly mainAsembly)
        {
            Schema.Current.ApplicationName = hostingEnvironment.ContentRootPath;

            SignumControllerFactory.RegisterArea(typeof(EntitiesController));
            SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod() !);

            ReflectionServer.Start();
            ReflectionServer.RegisterLike(typeof(SearchMessage), () => UserHolder.Current != null);
            ReflectionServer.RegisterLike(typeof(PaginationMode), () => UserHolder.Current != null);
            ReflectionServer.OverrideIsNamespaceAllowed.Add(typeof(DayOfWeek).Namespace !, () => UserHolder.Current != null);
            ReflectionServer.OverrideIsNamespaceAllowed.Add(typeof(CollectionMessage).Namespace !, () => UserHolder.Current != null);
        }
Exemple #4
0
        public static void Start(HttpConfiguration config, Assembly mainAsembly)
        {
            Schema.Current.ApplicationName = System.Web.Hosting.HostingEnvironment.ApplicationHost.GetPhysicalPath();

            config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
            config.Services.Replace(typeof(IHttpControllerSelector), new SignumControllerFactory(config, mainAsembly));

            SignumControllerFactory.RegisterArea(typeof(EntitiesController));
            // Web API configuration and services
            var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");

            config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);

            //Signum converters
            config.Formatters.JsonFormatter.SerializerSettings.Do(s =>
            {
                s.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
                s.Formatting            = Newtonsoft.Json.Formatting.Indented;
                s.Converters.Add(new LiteJsonConverter());
                s.Converters.Add(new EntityJsonConverter());
                s.Converters.Add(new MListJsonConverter());
                s.Converters.Add(new StringEnumConverter());
                s.Converters.Add(new ResultTableConverter());
                s.Converters.Add(new TimeSpanConverter());
            });

            SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod());


            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Services.Replace(typeof(IBodyModelValidator), new SignumBodyModelValidator());

            config.Filters.Add(new SignumAuthenticationFilterAttribute());
            config.Filters.Add(new SignumAuthorizationFilterAttribute());
            config.Filters.Add(new SignumExceptionFilterAttribute());
            config.Filters.Add(new VersionFilterAttribute());

            ReflectionServer.Start();
        }
Exemple #5
0
        public static void Start(IApplicationBuilder app, IHostingEnvironment hostingEnvironment, Assembly mainAsembly)
        {
            Schema.Current.ApplicationName = hostingEnvironment.ContentRootPath;

            //app.Services.Replace(typeof(IHttpControllerSelector), new SignumControllerFactory(config, mainAsembly));

            SignumControllerFactory.RegisterArea(typeof(EntitiesController));
            SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod());


            //// Web API configuration and services
            //var appXmlType = app.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
            //app.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);


            //// Web API routes
            //app.MapHttpAttributeRoutes();

            //app.Services.Replace(typeof(IBodyModelValidator), new SignumBodyModelValidator());


            ReflectionServer.Start();
        }