protected PomonaModule(IPomonaSessionFactory sessionFactory, string modulePath = "/", IPomonaDataSource dataSource = null) : base(modulePath) { Initialize(sessionFactory, dataSource); }
public DataSourceRootNode(ITypeMapper typeMapper, IPomonaDataSource dataSource) : base(typeMapper, null, "/") { if (dataSource == null) throw new ArgumentNullException("dataSource"); this.dataSource = dataSource; }
public static IQueryable Query(this IPomonaDataSource dataSource, Type type) { if (dataSource == null) { throw new ArgumentNullException(nameof(dataSource)); } if (type == null) { throw new ArgumentNullException(nameof(type)); } return(queryMethodInvoker(type, dataSource)); }
public static object Post(this IPomonaDataSource dataSource, Type type, object form) { if (dataSource == null) { throw new ArgumentNullException(nameof(dataSource)); } if (type == null) { throw new ArgumentNullException(nameof(type)); } if (form == null) { throw new ArgumentNullException(nameof(form)); } return(postMethodInvoker(type, dataSource, form)); }
public static object Patch(this IPomonaDataSource dataSource, Type type, object patchedObject) { if (dataSource == null) { throw new ArgumentNullException(nameof(dataSource)); } if (type == null) { throw new ArgumentNullException(nameof(type)); } if (patchedObject == null) { throw new ArgumentNullException(nameof(patchedObject)); } return(patchMethodInvoker(type, dataSource, patchedObject)); }
private void Initialize(IPomonaSessionFactory sessionFactory, IPomonaDataSource dataSource) { if (sessionFactory == null) { sessionFactory = PomonaModuleConfigurationBinder.Current.GetFactory(this); } this.sessionFactory = sessionFactory; this.dataSource = dataSource; // 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); }; foreach (var route in this.sessionFactory.Routes.Children) { RegisterRoutesFor((ResourceType)route.ResultItemType); } // For root resource links! Register(Get, "/", x => ProcessRequest()); Get[PomonaRouteMetadataProvider.JsonSchema, "/schemas"] = x => GetSchemas(); var clientAssemblyFileName = $"/{TypeMapper.Filter.ClientMetadata.AssemblyName}.dll"; Get[PomonaRouteMetadataProvider.ClientAssembly, clientAssemblyFileName] = x => GetClientLibrary(); RegisterClientNugetPackageRoute(); RegisterSerializationProvider(TypeMapper); }
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"); }
public TestPomonaModule(IPomonaDataSource dataSource, TypeMapper typeMapper) : base(dataSource, typeMapper) { }
protected PomonaModule(IPomonaDataSource dataSource, TypeMapper typeMapper, string modulePath) : this(typeMapper.SessionFactory, modulePath, dataSource) { }
protected PomonaModule(IPomonaDataSource dataSource, TypeMapper typeMapper) : this(dataSource, typeMapper, "/") { }
public ModuleContainer(NancyContext nancyContext, IPomonaDataSource dataSource, PomonaModule module) : base(nancyContext) { this.dataSource = dataSource; this.module = module; }