Is it possible to serve HTML pages with ServiceStack?

Using only ServiceStack for web and web services ServiceStack’s new Razor View Engine support A significant improvement to ServiceStack’s HTML story was added in v3.9.11 in the ServiceStack.Razor NuGet package. With this support ServiceStack now graduates to a full Website and Web Services framework that offers a much simpler replacement to WCF, MVC and WebApi. … Read more

How to omit Get only properties in servicestack json serializer?

ServiceStack’s Text serializers follows .NET’s DataContract serializer behavior, which means you can ignore data members by using the opt-out [IgnoreDataMember] attribute public class Poco { public int Id { get; set; } public string Name { get; set; } [IgnoreDataMember] public string IsIgnored { get; set; } } An opt-in alternative is to decorate every … Read more

OData with ServiceStack? [closed]

Edit ServiceStack has now added Auto Query which is our approach to enabling data-driven services that avoids the pitfalls and anti-patterns promoted by OData. Will ServiceStack support OData. No. Not directly anyway. If anyone sees any value in OData they are free to add the necessary functionality as an optional Plugin – but it will … Read more

How can I convert an XSD file to C# Class

Use the XML Schema Definition Tool xsd.exe found in your framework tools to convert your schema into a serializable class or dataset. xsd file.xsd {/classes | /dataset} [/element:element] [/language:language] [/namespace:namespace] [/outputdir:directory] [URI:uri] And in example, whereas the C# class will be generated in the same directory as the xsd tool: xsd /c YourFile.xsd

Best design pattern to control permissions on a “per object per user” basis with ServiceStack?

I use per object permissions in my ServiceStack applications. Effectively this is an Access-Control-List (ACL). I have created a Working Self Hosted Console Example which you can fork on GitHub. ACL pattern: I use the database structure shown in the diagram below, whereby resources in my database such as documents, files, contacts etc (any resource … Read more

Stop Fluent Validation on first failure

Just check for null before running the rules that depend on them, using a When condition. this.CascadeMode = CascadeMode.StopOnFirstFailure; RuleFor(x => x.TechnicalHeader).NotNull().WithMessage(“Header cannot be null”); // Ensure TechnicalHeader is provided When(x => x.TechnicalHeader != null, () => { RuleFor(x => x.TechnicalHeader.Userid).NotEmpty().WithMessage(“Userid cannot be null or an empty string”); RuleFor(x => x.TechnicalHeader.CabCode).GreaterThan(0).WithMessage(“CabCode cannot be or less … Read more

Are these the main differences between RestSharp and ServiceStack’s Client Code? [closed]

As the project lead of ServiceStack I can list some features of the ServiceStack Service clients: The ServiceStack Service Clients are opinionated in consuming ServiceStack web services and its conventions. i.e. They have built-in support for structured validation and error handling as well as all clients implement the same interface so you can have the … Read more

In what order are the ServiceStack examples supposed to be grokked?

ServiceStack example projects aren’t supposed to be consumed in any particular order, they’re just different examples illustrating what you can do with ServiceStack. Setting up ServiceStack If you want to know how to create and setup a ServiceStack service the easiest way is to Create your project with ServiceStackVS VS.NET extension, there’s also the Getting … Read more

ServiceStack.Net Redis: Storing Related Objects vs. Related Object Ids

Rather than re-hash a lot of other documentation that’s out there in the wild, I’ll list a couple around for some background info around Redis + ServiceStack’s Redis Client: What to think about when designing a NoSQL Redis application Designing a NoSQL Database using Redis General Overview of Redis and .NET Schemaless versioning and Data … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)