servicestack

How do I send a complex JSON object from an HTML form using SYNCHRONOUS page POST?

北城余情 提交于 2019-12-19 10:12:01
问题 My server is using ServiceStack and would like to receive some data like this: { Customer: { Company: "TheCompany", RegionCode: "AU_NSW" }, Name: { First: "Jimi", Last: "Hendrix" } } I have a form which has these fields and I can easily grab the data using JQuery, make the nested JSON object and use $.post to send it through. But I don't want to send it as AJAX, because I want the entire page to submit and then the browser to show the server's response as a new page. Just classic form post

ServiceStack - Validation and Database Access

孤人 提交于 2019-12-19 09:31:09
问题 I'm implementing an Api with ServiceStack. One of the key aspects of my solution is an aggressive validation strategy. I use ServiceStack's ValidationFeature, meaning that if there is an IValidator< ReqDto > (or its descendant: AbstractValidator< ReqDto >) registered in the app container, validation will automatically run prior to the service. By aggressive validation, what I mean is that I check all possible error scenarios, and logic validations at the validator level. As a result my

ServiceStack - Validation and Database Access

送分小仙女□ 提交于 2019-12-19 09:31:07
问题 I'm implementing an Api with ServiceStack. One of the key aspects of my solution is an aggressive validation strategy. I use ServiceStack's ValidationFeature, meaning that if there is an IValidator< ReqDto > (or its descendant: AbstractValidator< ReqDto >) registered in the app container, validation will automatically run prior to the service. By aggressive validation, what I mean is that I check all possible error scenarios, and logic validations at the validator level. As a result my

Servicestack.net Mini Profiler in razor view

僤鯓⒐⒋嵵緔 提交于 2019-12-19 08:53:06
问题 Is it possible to use the mini profiler in service stack with the razor views? It looks like the documentation only shows the profiler when using the json html report view. 回答1: Yes you can include it using the same MVC include but include it .AsRaw() so it doesn't get HTML encoded, e.g: @ServiceStack.MiniProfiler.Profiler.RenderIncludes().AsRaw() Example taken from this RazorRockstars template. 来源: https://stackoverflow.com/questions/12586343/servicestack-net-mini-profiler-in-razor-view

Servicestack.net Mini Profiler in razor view

喜你入骨 提交于 2019-12-19 08:50:04
问题 Is it possible to use the mini profiler in service stack with the razor views? It looks like the documentation only shows the profiler when using the json html report view. 回答1: Yes you can include it using the same MVC include but include it .AsRaw() so it doesn't get HTML encoded, e.g: @ServiceStack.MiniProfiler.Profiler.RenderIncludes().AsRaw() Example taken from this RazorRockstars template. 来源: https://stackoverflow.com/questions/12586343/servicestack-net-mini-profiler-in-razor-view

ServiceStack NHibernate Session per request

孤人 提交于 2019-12-19 05:55:26
问题 I am starting to build an app, and I'm planning to use ServiceStack. Just want to know what are the best practices/good approaches for handling NHibernate ISession or, other "per request" context specific session objects. I thought registering a ISessionFactory in the Ioc like: container.Register<ISessionFactory>(sessionFactory); And when needed get a new Session object... Or maybe provide the session object directly: container.Register<ISession>(c => sessionFactory.OpenSession())

ServiceStack NHibernate Session per request

我的梦境 提交于 2019-12-19 05:55:11
问题 I am starting to build an app, and I'm planning to use ServiceStack. Just want to know what are the best practices/good approaches for handling NHibernate ISession or, other "per request" context specific session objects. I thought registering a ISessionFactory in the Ioc like: container.Register<ISessionFactory>(sessionFactory); And when needed get a new Session object... Or maybe provide the session object directly: container.Register<ISession>(c => sessionFactory.OpenSession())

Accessing ServiceStack Authenticated Service using Ajax

我只是一个虾纸丫 提交于 2019-12-19 04:14:44
问题 I've been working through a simple API example, a modified version of the ServiceStack Hello World example with authentication. The goal of the proof of concept is to create an a RESTful API that contains services requiring authentication accessible entirely through Ajax from several different web projects. I've read the wiki for, and implemented, Authentication and authorization and implementing CORS (many, results [sorry, not enough cred to point to the relevant link]). At this point, my

ServiceStack: Serving Static files from a directory when present?

旧城冷巷雨未停 提交于 2019-12-19 04:00:44
问题 I am in the process of converting my stand-alone home grown web server to use ServiceStack for serving all pages and resources. I see from this question Serving a static file with servicestack that it is easy to serve a single static file with Service Stack. In my home grown implementation, after checking to see if a URL matches any particular handler (equivalent to ServiceStack routes), the default handler then checks for a static file in its HttpData directory to serve matching the URL. If

ServiceStack: Serving Static files from a directory when present?

╄→гoц情女王★ 提交于 2019-12-19 04:00:42
问题 I am in the process of converting my stand-alone home grown web server to use ServiceStack for serving all pages and resources. I see from this question Serving a static file with servicestack that it is easy to serve a single static file with Service Stack. In my home grown implementation, after checking to see if a URL matches any particular handler (equivalent to ServiceStack routes), the default handler then checks for a static file in its HttpData directory to serve matching the URL. If