0

Currently we are using the WCF services in C# as a web services and we want to migrate it to Service Stack Web API. So what is the best option to migrate it to Service Stack API..?

We are using WCF + SQL Server as a database.

What is the best combinations for ServiceStack + SQL Server to faster the APIs?

Any suggestion will be grateful..

Ravi Tuvar
  • 191
  • 1
  • 2
  • 14

1 Answers1

0

ServiceStack and WCF are fundamentally different

There's no automated migration tool for converting WCF Services -> ServiceStack as they don't share any of the same libraries and have a fundamentally different approaches for developing web services. However you should be able to re-use a lot of your DTO's and custom web services implementation logic that don't contain references to WCF libraries.

Learn how to create message-based Services

I would first start with going through how to developer message-based services with ServiceStack and how it contrasts with WCF-style Web Services at: https://stackoverflow.com/a/15941229/85785

Porting approach

If you have an existing WCF Service you should be able to extract the WCF Services implementation and port them to ServiceStack Services whilst being able to re-use a lot of your existing WCF DTO's, existing ORM logic and impl where you can registering any other dependencies you might have in ServiceStack's IOC.

Switching to OrmLite SqlServer

If you prefer you may also want to consider switching to ServiceStack's OrmLite which provides a nice light, typed SQL and LINQ-like API for accessing the most popular RDBMS's including Sql Server which you can register with a single line in your AppHost.Configure():

container.Register<IDbConnectionFactory>(c =>
    new OrmLiteConnectionFactory(connString, SqlServerDialect.Provider));

With just this single line of registration above you can now connect with your SqlServer database using the ADO.NET connection available at base.Db, e.g:

public class MyServices : Service
{
    public object Any(Request request)
    {
        return base.Db.Select<Poco>();
    }
}

Take advantage of AutoQuery's rich data-driven Services

This will also let you take advantage of rich querying functionality in AutoQuery to quickly develop data-driven services.

Community
  • 1
  • 1
mythz
  • 141,670
  • 29
  • 246
  • 390