We have another exciting release for anyone already on or are looking to use AWS in future.
I’ll do my best to provide a short summary, please also see the complete details in the Release Notes
ServiceStack.Aws
All of ServiceStack’s support for AWS is encapsulated within the single ServiceStack.Aws NuGet package
which references the latest AWSSDK v3.1x dependencies for .NET 4.5+ projects, containing:
- PocoDynamo - Exciting new declarative, code-first POCO client for DynamoDB with LINQ support
- SqsMqServer - A new MQ Server for invoking ServiceStack Services via Amazon SQS MQ Service
- S3VirtualPathProvider - A read/write Virtual FileSystem around Amazon’s S3 Simple Storage Service
- DynamoDbAuthRepository - A new UserAuth repository storing UserAuth info in DynamoDB
- DynamoDbAppSettings - An AppSettings provider storing App configuration in DynamoDB
- DynamoDbCacheClient - A new Caching Provider for DynamoDB
PocoDynamo
is a highly productive, feature-rich, typed .NET client which extends ServiceStack’s Simple code-first POCO approach
and re-use of your code-first data models with Amazon’s industrial strength and highly-scalable NoSQL DynamoDB.
There’s comprehensive docs available in the PocoDynamo Repo.
AWS Apps
To demonstrate the ease of which you can build AWS-powered solutions with ServiceStack we’ve rewritten
6 of our existing Live Demos to use a pure AWS managed backend using:
- Amazon DynamoDB for data persistance
- Amazon S3 for file storage
- Amazon SQS for background processing of MQ requests
- Amazon SES for sending emails
AWS Razor Rockstars
An interesting feature with AWS RazorRockstars is that all the content for the App is not contained
within project as all its Razor Views, Markdown Content, imgs, js, css, etc. are instead being
served directly from an S3 Bucket
Live Reload Demo
One nice feature of having all content maintained in an S3 Bucket is that you can just change
files in the S3 Bucket directly and have all App Servers immediately reload the Razor Views,
Markdown content and static resources without redeploying.
You can test live reloading of the above Service with the routes below which modify Markdown
and Razor views with the current time:
- /updateS3 - Update Markdown Content
- /updateS3?razor=true - Update Razor View
- /updateS3?razor=true&clear=true - Revert changes
AWS Imgur and AWS REST Files
are both good examples showcasing how you can easily change which file storage backend uploaded files get
saved to by overriding the new VirtualFiles property with your preferred file storage provider:
var s3Client = new AmazonS3Client(AwsConfig.AwsAccessKey, AwsConfig.AwsSecretKey, RegionEndpoint.USEast1);
VirtualFiles = new S3VirtualPathProvider(s3Client, AwsConfig.S3BucketName, this);
If we comment out the above configuration any saved files are instead written to the local FileSystem (default).
AWS Email Contacts
The AWS Email Contacts example shows the same long-running EmailContact Service being executed
from both HTTP and MQ Server by just changing which url the HTML Form is posted to.
AWS Auth
AWS Auth is an example showing how easy it is to enable multiple Auth Providers within the same App and
have all User Auth info stored in DynamoDB using the new DynamoDbAuthRepository.
AWS Todos
is a good illustration of the clean and minimal code it takes to build a simple CRUD Service using the new PocoDynamo client:
public class TodoService : Service
{
public IPocoDynamo Dynamo { get; set; }
public object Get(Todo todo)
{
if (todo.Id != default(long))
return Dynamo.GetItem<Todo>(todo.Id);
return Dynamo.GetAll<Todo>();
}
public Todo Post(Todo todo)
{
Dynamo.PutItem(todo);
return todo;
}
public Todo Put(Todo todo)
{
return Post(todo);
}
public void Delete(Todo todo)
{
Dynamo.DeleteItem<Todo>(todo.Id);
}
}
AWS Getting started with Guides
We’ve provided a number of guides to walk through setting up AWS services starting from your AWS account
and connect to them with ServiceStack libs.
Mastering ServiceStack
Andreas Niedermair’s new book on Mastering ServiceStack is now available, check it out!
TypeScript
We’ve extended our existing TypeScript support for generating interface definitions for your DTO’s
with the new ExportAsTypes=true
option for generating non-ambient concrete TypeScript Types.
All urls returned in the default HTML5 pages are now auto-hyperlinked which we can preview in the new
/types
route which returns links to the different languages Add ServiceStack Reference supports:
New License Key Registration option
To simplify license key registration when developing and maintaining multiple ServiceStack solutions
we’ve added a new option where you can now just register your License Key once in
SERVICESTACK_LICENSE
Environment Variable.
Virtual File System
There’s a new read/write Virtual FileSystem interface with local FileSystem, In Memory and S3 file storage providers.
HttpResult
You can customize JSON serialization for adhoc services with the new ResultScope:
return new HttpResult(dto) {
ResultScope = () => JsConfig.With(includeNullValues:true)
};
Which enables custom serialization behavior by performing the serialization within the custom scope, equivalent to:
using (JsConfig.With(includeNullValues:true))
{
var customSerializedResponse = Serialize(dto);
}
- New cookies can be added to HttpResult’s new IHttpResult.Cookies collection
- New constructor for returning VirtualFile downloads: new HttpResult(VirtualFiles.GetFile(targetPath), asAttachment: true);
AutoQuery
new %!
and %NotEqualTo
implicit query convention available on all Auto queries:
- /rockstars?age!=27
- /rockstars?AgeNotEqualTo=27
Improved support for Xamarin.Mac
The ServiceStack.Client PCL provider for Xamarin.Mac now has an explicit reference Xamarin.Mac.dll
which allows it to work in projects with the Link SDK Assemblies Only.
Redis
- Behavior of
Redis.StoreAsHash
can be modified withRedisClient.ConvertToHashFn
- RedisReact Browser updates https://github.com/ServiceStackApps/RedisReact#update---27-october-2015
OrmLite
New System Variables allow declaring column with the default value of RDBMS UTC Time:
public class Poco
{
[Default(OrmLiteVariables.SystemUtc)] //= {SYSTEM_UTC}
public DateTime CreatedTimeUtc { get; set; }
}
Preview of a new parameterized SqlExpression provider that’s now available for SQL Server and Oracle, opt-in with:
OrmLiteConfig.UseParameterizeSqlExpressions = true;
Johann Klemmack added support for selectively specifying which references you want to load, e.g:
var customerWithAddress = db.LoadSingleById<Customer>(customer.Id, include: new[] { "PrimaryAddress" });
//Alternative
var customerWithAddress = db.LoadSingleById<Customer>(customer.Id, include: x => new { x.PrimaryAddress });
OrmLite’s T4 templates for generating POCO types from an existing database schema has improved
support for generating stored procedures thanks to Richard Safier.
ServiceStack.Text
new ConvertTo<T>
on JsonObject
helps dynamically parsing JSON into typed POCO.
Minor Features
- Server Events /event-subscribers route now returns all channel subscribers
- PATCH method is allowed in CORS Feature by default
- Swagger Summary for all servies under a particular route can be specified in SwaggerFeature.RouteSummary Dictionary
- New requested FacebookAuthProvider.Fields can be customized with oauth.facebook.Fields
- Added Swift support for TreatTypesAsStrings for returning specific .NET Types as Strings
- New IAppSettings.GetAll() added on all AppSetting sources fetches all App config in a single call
- ServiceStackVS updated with ATS exception for React Desktop OSX Apps
- External NuGet packages updated to their latest stable version
Apologies for the long TL;DR - please see the Release Notes for the even longer version
Enjoy!