Why does ServiceStack v3.9.28 nuget not contain SqlServerStorage class for MiniProfiler - servicestack

I used the nuget command to get the ServiceStack dll's. The 3.9.28 I have does not contain the SqlServerStorage class in the MiniProfiler namespace. Why is that?

ServiceStack includes a port of MiniProfiler that's integrated to work with ServiceStack. To remove conflicts ServiceStack's port is kept under the ServiceStack.MiniProfiler namespace at which place you will find the SqlServerStorage.cs class.

Related

Service stack from a web application

I was looking at integrating a class library that uses service stack with an existing web application. I added the class library and its reference dlls in the bin folder for the web application and entries in the web.config file for dependency injection but I am getting an error as below. Please let me know the best way to approach this issue.
error: ServiceStack: AppHost does not exist or has not been initialized. Make sure you have created an AppHost and started it with 'new AppHost().Init();' in your Global.asax Application_Start() or alternative Application StartUp
Go through Creating your first web service from scratch to walk through how to add ServiceStack to an empty ASP.NET Web Application.
AppHost is your own class that you create that inherits AppHostBase.
You should get the .dlls from the ServiceStack NuGet package, but otherwise you never want to put dlls in /bin folder yourself, if you instead want to reference a copy of the ServiceStack dlls they should be in an external folder like /lib, when VS.NET builds your project it will automatically copy it to the /bin folder.
I would still recommend using the NuGet packages, but if you want to reference .dlls have a look at the Chat demo which references copy of ServiceStack dlls in custom /lib folder, it also has the minimal libs required for a ServiceStack + Razor ASP.NET Web Application.
Did you try to do what the error description suggested? Go into global.asax.cs, and add:
new AppHost().Init();
into the Application_Start() method.

MvvmCross registering interfaces using IoC in Xamarin iOS7 and XCode 5

I'm having an issue activating the IMvxMessenger using IoC. (Mac, Xamarin Studio, iOS7, Mono 3.2)
I have downloaded NPlus1DaysOfMvvmCross and loaded the N37 Maps project.
Compiled the project and it works fine.
I then added the Cirrious.MvvmCross.Plugins.Messenger.dll to the project and the following code to the app.cs Initialize just below the service IoC call.
CreatableTypes (typeof(IMvxMessenger).Assembly).AsInterfaces ().RegisterAsSingleton ();
I receive and error when compiling that says:
Failed to resolve parameter for parameter id of type Guid when creating Cirrious.MvvmCross.Plugins.Messenger.MvxSubscriptionToken
IMvxMessenger is a plugin and does not need to be registered for IoC in the way you are doing it. Plugins get registered by creating a bootstrap class for each of the plugins you want to use in your project like so:
public class MessengerPluginBootstrap
: MvxPluginBootstrapAction<Cirrious.MvvmCross.Plugins.Messenger.PluginLoader>
{
}
Some plugins with platform dependent parts, such as the Visibility Plugin, need to be registered in a different manner on iOS, because it is silly:
public class VisibilityPluginBootstrap
: MvxLoaderPluginBootstrapAction<Cirrious.MvvmCross.Plugins.Visibility.PluginLoader, Cirrious.MvvmCross.Plugins.Visibility.Touch.Plugin>
{
}
This way you should be able to use the types inside of the Plugin using IoC.
This doesn't sound like it's anything to do with ios7
The line of code
CreatableTypes(typeof(IMvxMessenger).Assembly)
.AsInterfaces()
.RegisterAsSingleton ();
will:
take all the creatable types in the assembly (ie any non-abstract types with a public constructor)
will then find their interfaces
will then create a new instance and register that as the singleton implementation for the interfaces.
For the Messenger plugin, that includes trying to new and register an MvxSubscriptionToken as an IDisposable singleton - although this fails as the public constructor for MvxSubscriptionToken requires a Guid (and you haven't told MvvmCross how to supply that - so the construction fails)
If you did want to just register specific types in an Assembly, then normally you'd add a EndingWith("PostFix") clause - like the default Mvx nuget templates do with Services as the postfix.
If you did want to just register a single specific class from an Assembly, then you'd often just do that as:
Mvx.RegisterSingleton<IThing>(new Thing());
However, for plugins - which are just a convention-based set of rules placed on top of IoC - what you normally want to do is to call EnsureLoaded() on the plugin manager for the PluginLoader for that plugin.
The easiest way to do that is to include a Bootstrap file in the UI project - see the examples in N=8 - https://github.com/slodge/NPlus1DaysOfMvvmCross/tree/master/N-09-Location%20And%20Message/Location.Touch/Bootstrap - your application's Setup will use Reflection to find that Type and will then call EnsureLoaded on the plugin for you.
For more on IoC in MvvmCross, see https://github.com/slodge/MvvmCross/wiki/Service-Location-and-Inversion-of-Control
For more on plugins, see https://github.com/slodge/MvvmCross/wiki/MvvmCross-plugins
Make sure the plugin is installed in the Core project AND the Android project.

Servicestack - run built-in clients on the .net client profile framework

Is it possible to run servicestack's built-in clients on the .net client profile framework?
When i change the target framework property in the project settings to ".Net Framework Client Profile" and try to compile i get the following message: the namespace ServiceClient does not exist in the namespace servicestack.
We use servicestack services to send exception reports. We use the JsonServiceClient and feel really comfortable with it. We could change the target framework - but then we have to check all installations for the availability of the full .net framework.
Any idea how to solve this?
Thanks.
From the package contents of the latest ServiceStack.Common package there seems to be no -client version included (See Common Framework and Profile Targeting Examples under NuGet - Creating and Publishing a Package).
You should either change the target framework the full profile or pull the code from ServiceStack's GitHub Repo and try to build it for client profile yourself. The downside of this is that you will loose Nuget's awesome update features...
You could off course file an issue at GitHub for the guys maintaining ServiceStack to add a client profile version of the framework, but I guess that there's a good reason for why it's not there already.

Register over-ridable ServiceStack service

We're using ServiceStack within a package that users install onto their Umbraco website. The tricky thing is the users need to be able to add additional methods specific to their implementation.
I'm aware of the ability to pass in multiple assemblies but the issue is we can't leverage global.asax and I believe PreApplicationStartMethod needs to be compiled (so can't be changed).
Can anyone think of a way we can have an overrideable AppHost (or override the default)?
The AppHost needs to be Init, i.e. new AppHost().Init() within the scope of Application_Init event.
As for registering services, apart from scanning the assemblies in the base constructor, you can override what services get registered by overriding AppHost.CreateServiceManager() and returning a ServiceManager configured with only the services you wish to support.
Beyond that you can dynamically register services by using RegisterService either in your AppHost.Configure() or in a IPlugin, e.g:
appHost.RegisterService<RegistrationService>("/AtRestPath");

Where is ServiceStack.Data.SqlMapper.QueryMultiple and ServiceStack.Data.DynamicParameters

I recently upgraded ServiceStack related libraries (specially ServiceStack 2.9.25), and with previous releases we had ServiceStack.Data namespace and we were using ServiceStack.Data.DynamicParameter class and IDbConnection extension methods such as Execute and QueryMultiple. But in latest version we don't have this namespace so as the above classes and methods. Are these moved to somewhere else and any alternative classes/methods to use?
SqlMapper / Dapper has now moved to ServiceStack.Razor.Dapper namespace which is in the ServiceStack.Razor project.

Resources