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

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.

Related

Nuxeo automation and a custom enricher

I'm trying to learn how to develop my own enricher (I believe I do understand the basic, in terms of how enrichers relate to automation chains and so on). However, I'm having problems:
I can use existing enrichers with, for example,
Document.FetchByProperty and everything will work
But once I include my own custom enricher, I get the error (link below)
I couldn't figure out what I'm doing wrong, so I've took existing custom enricher from Nuxeo sample project, and got the same error
Any help is welcome!
Log link: https://answers.nuxeo.com/api/files/2b14d403-aa8a-4ac3-81ca-c9ee13623c2a
I've also asked the same question here:
https://answers.nuxeo.com/general/q/af5a6369c91942b5a81bf61549b467f2/Automation-and-a-custom-enricher
Make sure that you are compiling the enricher code with the same version of Nuxeo libraries as is the version of the target platform.
For example sample project is using the latest version (currently 11.1-SNAPSHOT) and the result code will not be compatible with Nuxeo platform 9.2. Especially abstract methods can have problems.
So there should be this section in pom.xml with <version>9.2</version> in your case:
<parent>
<groupId>org.nuxeo</groupId>
<artifactId>nuxeo-addons-parent</artifactId>
<version>9.2</version>
</parent>
The reason why the java.lang.AbstractMethodError is thrown here is in JsonGenerator. Nuxeo 9.2 uses org.codehaus.jackson.JsonGenerator while newer Nuxe versions use com.fasterxml.jackson.core.JsonGenerator.
Then this method signature (in 9.2):
public void write(org.codehaus.jackson.JsonGenerator jsonGenerator, DocumentModel documentModel) throws IOException;
... is not compatible with this (in 10.3 for example):
public void write(com.fasterxml.jackson.core.JsonGenerator json, DocumentModel document) throws IOException;
And Java is then not able to find correct write() method implementation and throws AbstractMethodError.

How to override UserLocalServiceImpl in liferay 7 without service wrapper?

I created service wrapper for UserLocalServiceImpl and declared a new method inside the service wrapper. But when I explicitly call that method using UserLocalServiceUtil the compiler could not resolve this method. So, kindly help me and tell how to override UserLocalServiceImpl so that I can define new methods inside it. Thanx in advance..
This doesn't work. You'd change the interface of Liferay's published API and basically be incompatible with any other plugin that assumes Liferay's API.
While you technically have access to all of Liferay's source code and can build a modified version of Liferay, introducing this change, it would mean that no marketplace plugin (that uses UserLocalService) would be compatible with your customized version. Any OSGi component can hook into Liferay and get into the callstack for the published API, no OSGi plugin can extend a published interface so that the original interface then has more methods than Liferay's published API.
The best thing you can do if you rely on a separate function call: Create your custom service that makes calls to UserLocalService.
Further more, in Liferay 7 you shouldn't use UserLocalServiceUtil any more, rather get the service dependency properly injected through a #Reference annotation. The *LocalServiceUtil classes are there purely for backwards compatibility and to be used only from *.WAR style plugins.
You can do
UserLocalServiceUtil.getService()
and then cast the result to your custom wrapper type. Then you should be able to call the new method.

How to use kernal in ServiceStack version="4.0.36"

I want to use StandardKernel object in my IOC container for that I downloaded “ServiceStack.ContainerAdapter.Ninject”. this Ninject is dependency with ServiceStack.Common (≤ 3.9.59) but I AM using the latest version of ServiceStack version="4.0.36".
Can anyone suggest me how to use kernel in ServiceStack version="4.0.36".
IKernel kernel = new StandardKernel
According to the package's nuGet page , this package has a dependency on ServiceStack 3.9.59 and below. It doesn't appear to currently support the 4.x version of ServiceStack.
Looks like the code is hosted on github. You could contact the author and ask him about supporting 4.x or you could fork it, make it compatible with 4.x and then submit a pull request.

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.

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

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.

Resources