servicestack

ServiceStack / ORM Lite - Foreign Key Relationships

北慕城南 提交于 2019-12-04 15:23:10
I have the following POCO: [Alias("Posts")] public class Post : IReturn<Post> { [AutoIncrement] [PrimaryKey] public int PostId { get; set; } public DateTime CreatedDate { get; set; } [StringLength(50)] public string CreatedBy { get; set; } [StringLength(75)] public string Title { get; set; } public string Body { get; set; } public int UpVote { get; set; } public int DownVote { get; set; } public bool IsPublished { get; set; } public List<Comment> Comments { get; set; } public List<Tag> Tags { get; set; } } It has a FK on my Comment and Tag entities. So I'd like to return those in my response

Does ORMLite support dynamic Type of C#?

不打扰是莪最后的温柔 提交于 2019-12-04 15:07:51
I am looking into ORMLite from ServiceStack and what I am trying to do here is that call a stored procedure which in turn return many many rows which definitely would not be bound to any domain object but also may or may not have a dto object to map with. I was wondering if I can bind it to a type. However, it sounds like ORMLite does not support dynamic type binding at this time. Does ORMLite support at this point? By design OrmLite does not support marshalling to dynamic types, and expects resultsets to mapped to Typed POCO's. Although it does have specialized API's to access Dynamic Result

ServiceStack.Redis.Sentinel Usage

霸气de小男生 提交于 2019-12-04 14:42:19
问题 I'm running a licensed version of ServiceStack and trying to get a sentinel cluster setup on Google Cloud Compute. The cluster is basically GCE's click-to-deploy redis solution - 3 servers. Here is the code i'm using to initialize... var hosts = Settings.Redis.Host.Split(';'); var sentinel = new ServiceStack.Redis.RedisSentinel(hosts, "master"); redis = sentinel.Setup(); container.Register<IRedisClientsManager>(redis); container.Register<ICacheClient>(redis.GetCacheClient()); The client works

How does ServiceStack PooledRedisClientManager failover work?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 13:44:24
问题 According to the git commit messages, ServiceStack has recently added failover support. I initially assumed this meant that I could pull one of my Redis instances down, and my pooled client manager would handle the failover elegantly and try to connect with one of my alternate Redis instances. Unfortunately, my code just bugs out and says that it can't connect with the initial Redis instance. I am currently running instances of Redis 2.6.12 on a Windows, with the master at port 6379 and a

How do I translate complex objects in ServiceStack?

99封情书 提交于 2019-12-04 13:34:13
问题 Suppose I have two objects: class Order { string Name {get; set;} Customer Customer {get; set;} Item[] Items {get; set;} } and class OrderDTO { string Name {get; set;} CustomerDTO Customer {get; set;} ItemDTO[] Items {get; set;} } If I receive an object orderDTO that is fully populated and do orderDTO.TranslateTo<Order>() the result will only have Name populated, not Customer or Items . Is there a way to do a recursive translation or the only option is to translate Customer and each of the

How to build secured api using ServiceStack as resource server with OAuth2.0?

夙愿已清 提交于 2019-12-04 13:03:58
问题 I have build a OAuth2.0 Authorization server using dotnetopenauth that will manage authentication, authorization, and assign accessToken to the caller. The caller will use the access token to access the api (webservices) at resource server. If follow the sample provided by dotnetopenauth in Resource Server, api that builded using WCF can be authenticated by OAuthAuthorizationManager If using ServiceStack to build my api in Resource Server, how to build the authentication process that verify

ServiceStack Selfhosted Application Restart

ぃ、小莉子 提交于 2019-12-04 12:58:08
How can I restart a ServiceStack self hosted Apphost? Setting my AppHost instance to null and disposing of it does not work correctly, it throws the following Exception: System.ArgumentException: An entry with the same key already exists. I need to be able to do this to reload settings and start the AppHost without restarting the Windows Service hosting the AppHost EDIT: Scott and Moo-Juice's suggestions to run the AppHost in a different AppDomain is the correct solution. In order to get past the Cross Domain calls to restart the AppHost, I created a second AppHost which runs in the Main

ServiceStack AppHost Is a Singleton?

心已入冬 提交于 2019-12-04 12:18:05
问题 I have been evaluating ServiceStack and so far, I've been pretty much sold - but I have a requirement that I think is going to be a deal-breaker. I basically need multiple AppHost-derived instances. The first one spins up nicely, but the rest fail because "AppHostBase.Instance has already been set". Does this mean if I want multiple hosts (on different Uris), to be in different executables? If so this is rather disappointing as this library is perfect in every single other way, other than

Encrypting messages over ServiceStack

孤人 提交于 2019-12-04 11:43:17
Given an app that needs to exchange info such as ConsumerKey/ConsumerSecret for oAuth from - server running "WebApi" over ServiceStack - consumer is a desktop app Looking to encrypt the messages using Public/Private keys which are already in place Is there any support for encrypting/decrypting messages, hopefully transparently ? i.e. the encrypting/decryption is handled via say Filters on the server ? OR any workaround on how to do this ? FYI - the server already requires SSL and requests are authenticated, however the registration is free/automated, hence the need for encryption Update The

Alternative to cookie based session/authentication

*爱你&永不变心* 提交于 2019-12-04 11:34:05
问题 Is there an alternative to the session feature plugin in servicestack? In some scenarios I cannot use cookies to match the authorized session in my service implementation. Is there a possibility to resolve the session using a token in http header of the request? What is the preferred solution for that in case the browser is blocking cookies? 回答1: I'm using ServiceStack without the built-in auth and session providers. I use a attribute as request filter to collect the user information (id and