Inheritance: Pomona.Common.TypeSystem.ExportedTypeResolverBase
Beispiel #1
0
 public PomonaSessionFactory(TypeMapper typeMapper, Route routes, IRouteActionResolver actionResolver)
 {
     TypeMapper = typeMapper;
     ActionResolver = actionResolver;
     Routes = routes;
     this.pipeline = new DefaultRequestProcessorPipeline();
     this.serializerFactory = new PomonaJsonSerializerFactory();
 }
Beispiel #2
0
        public EnumType(Type mappedType, TypeMapper typeMapper, Dictionary<string, int> enumValues)
        {
            if (mappedType == null)
                throw new ArgumentNullException("targetType");
            if (typeMapper == null)
                throw new ArgumentNullException("typeMapper");
            if (enumValues == null)
                throw new ArgumentNullException("enumValues");

            if (!mappedType.IsEnum)
                throw new ArgumentException("Type is not enum.", "targetType");

            this.mappedType = mappedType;
            this.typeMapper = typeMapper;
            this.enumValues = enumValues;
        }
Beispiel #3
0
        protected PomonaModule(
            IPomonaDataSource dataSource,
            TypeMapper typeMapper)
        {
            // HACK TO SUPPORT NANCY TESTING (set a valid host name)
            Before += ctx =>
            {
                if (String.IsNullOrEmpty(ctx.Request.Url.HostName))
                    ctx.Request.Url.HostName = "test";
                return null;
            };

            this.dataSource = dataSource;

            this.typeMapper = typeMapper;

            foreach (var transformedType in this.typeMapper
                .TransformedTypes.OfType<ResourceType>()
                .Select(x => x.UriBaseType)
                .Where(x => x != null && !x.IsAnonymous() && x.IsRootResource)
                .Distinct())
                RegisterRoutesFor(transformedType);

            Get["/schemas"] = x => GetSchemas();

            Get[String.Format("/{0}.dll", this.typeMapper.Filter.GetClientAssemblyName())] = x => GetClientLibrary();

            RegisterClientNugetPackageRoute();

            Get["/"] = x => GetJsonBrowserHtmlResponse();
            RegisterResourceContent("antlr3-all-min.js");
            RegisterResourceContent("antlr3-all.js");
            RegisterResourceContent("PomonaQueryJsLexer.js");
            RegisterResourceContent("PomonaQueryJsParser.js");
            RegisterResourceContent("QueryEditor.css");
            RegisterResourceContent("QueryEditor.js");
        }
Beispiel #4
0
 public TestPomonaModule(IPomonaDataSource dataSource, TypeMapper typeMapper)
     : base(dataSource, typeMapper)
 {
 }
 public virtual void OnMappingComplete(TypeMapper typeMapper)
 {
 }
 public TestPomonaBootstrapper(ISessionFactory sessionFactory)
 {
     this.sessionFactory = sessionFactory;
     typeMapper = new TypeMapper(new TestPomonaConfiguration());
 }
Beispiel #7
0
 protected PomonaModule(IPomonaDataSource dataSource, TypeMapper typeMapper, string modulePath)
     : this(typeMapper.SessionFactory, modulePath, dataSource)
 {
 }
Beispiel #8
0
 protected PomonaModule(IPomonaDataSource dataSource, TypeMapper typeMapper)
     : this(dataSource, typeMapper, "/")
 {
 }