servicestack

Funq usage in ServiceStack

隐身守侯 提交于 2020-01-12 05:35:20
问题 How can I access Container instance out of controller? I have to use Container.Resolve in my class but how can I access Container instance? Is it singleton? Can I use new Container() or is there any chain like Funq.StaticContainer ? Thanks to Mythz for gist hint, a) or b) or c). I will use Mythz's solution, it is accepted by me but there are concerns for it's pattern ( ServiceLocator Pattern), you can check here for extra info. 回答1: There are a couple of ways to statically reference your

Host ServiceStack, MVC3 or MVC4 on mono or windows and what is the state of mono

纵然是瞬间 提交于 2020-01-12 03:52:17
问题 I am trying to decide what stack to use for a new web based backoffice system. We develop in C# and are going to use ServiceStack and/or ASP.NET MVC. Our customer prefers hosting on a Linux server, so this rules out MVC4 as this is not supported by Mono. Additionally we are worried about the state of the mono-fastcgi-server needed to run ASP.NET on Mono because of posts like this https://serverfault.com/questions/330298/stopping-fastcgi-mono-server-gracefully-website-content-updating-with-no

ServiceStack IAuthSession empty after authentication with FacebookAuthProvider

末鹿安然 提交于 2020-01-11 12:25:48
问题 I'm trying to get the user data through IAuthSession after a doing an authentication with facebook, when I try get the user with Request.GetSession(true) which returns AuthUserSession (implements IAuthSession) I get a partial subset of data like the following: I'm trying to use it in a service method [ClientCanSwapTemplates] [DefaultView("dashboard")] public DashboardResponse Get(FacebookRequest userRequest) { var user1 = Request.GetSession(true); return new DashboardResponse(); } I've added

ServiceStack using DotNetStandard Service Model in .Net framework web project

依然范特西╮ 提交于 2020-01-11 10:37:34
问题 We recently created a new DotNetCore web service using ServiceStack. The ServiceModel project is a DotNet Standard class library v2.0. I am getting compiling errors while referencing the new ServiceModel from our existing web services that were written in DotNet Framework 4.6.1. Looks like by referencing the new ServiceModel, it is pulling in ServiceStack.Interfaces.Core which conflict with ServiceStack.Interfaces already referenced in the DotNet Framework project. We are not looking to

ServiceStack.Text how to serialize class to JSon

白昼怎懂夜的黑 提交于 2020-01-09 10:22:43
问题 Just downloaded ServiceStack.Text to use it in my ASP.NET. I have class with many properties and would like to serialize five of them(string, integer, binary) to JSON. Could anyone post simple example how to create JSon object from my class? 回答1: ServiceStack will deserialize all public properties of a POCO by default. If you only want to serialize just a few of the properties then you want to decorate your class with [DataContract], [DataMember] attributes (in the same way you would if you

MissingMethodException get_QueryString

喜欢而已 提交于 2020-01-06 01:21:39
问题 I come across this exception in my .net core app (.net core 2.1 and I'm using service stack 5.2). Method not found: 'ServiceStack.Web.INameValueCollection ServiceStack.Web.IRequest.get_QueryString()'. It comes from one of the plugins originally, but I can't figure out why. Code breaks on this line here. session.ReferrerUrl = GetReferrerUrl(authService, session, request); Btw, in app console I also get this: warn: ServiceStack.Serialization.StringMapTypeDeserializer[0] Property 'redirect' does

How can I modify the SQL generated by ServiceStack.OrmLite?

蹲街弑〆低调 提交于 2020-01-05 10:10:57
问题 I want to use ServiceStack's OrmLite in C# to query AWS RedShift. AWS RedShift uses the postgresql wire protocol as its query interface, and puts some constraints on the queries that can be run, one of which is that it cannot accept parameterised queries (I've been told; I haven't actually been able to find this backed up in documentation yet). So, I am investigating whether it would be possible to use an ORM to generate parameterised SQL, then find/replace in the parameter values. How can I

What is happening in debug compilation that is causing the query to take longer to execute?

ぃ、小莉子 提交于 2020-01-05 09:37:49
问题 ServiceStack 3.9.69 via Nuget using SqlServer OrmLite dialect I'm attempting to execute a parameterized stored procedure but am noticing an unusual slowness when the compilation mode is set to debug . The method that is slow is ConvertToList below: Dim result = Db.Exec(Of List(Of Dto.FieldSample))( Function(cmd) cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "up_GetFieldSample" cmd.Parameters.Add(New SqlClient.SqlParameter("@uploadID", uploadId)) Dim reader = cmd

HttpCompileException: “External exception” when trying to access razor view in ServiceStack hosted on Apache+mod_mono

雨燕双飞 提交于 2020-01-05 09:34:39
问题 I am getting HttpCompileException when trying to access a razor view. Error log contains no information. The same deployment works on NGinx+FastCGI, but not on Apache+mod_mono. I am not using the mod_mono AutoConfiguration because I have not (yet) found a way how to make it work. This is my "manual" apache2.conf configuration for mono: MonoAutoApplication disabled AddHandler mono .aspx .ascx .asax .ashx .config .cs .asmx .axd MonoApplications "/:/var/www/MyAppName" <Location /> SetHandler

ServiceStack Razor with Multiple SPAs

不羁的心 提交于 2020-01-05 06:26:27
问题 I don't see an example of using ServiceStack Razor with Multiple SPAs on the internet. The reason for having multiple SPAs in my use case is because my entire site is quite huge and I would like to modularize my site with multiple SPAs. I am aware of the FallbackRoute attribute but it seems to only allow one FallbackRoute based on the documentation? I would like to have, for example, these routes in my app that routes to their respective SPA www.mydomain.com/spa1/... www.mydomain.com/spa2/...