I'm using the latest NuGet packages for MvvmCross CrossCore, Hot Tuna, Location and Picture Plug ins, but I can't seem to find in the object browser the IMvxServiceProducer and IMvxServiceConsumer classes that are used in many examples. Doing a search for RegisterServiceInstance, I found Cirrious.CrossCore.IoC.MvxIoCExtensions. Did the two interfaces go away in place of something simpler?
Those interfaces were used in many v1 and vNext samples, but in v3 they have all been replaced with Mvx.Resolve<T> service location, or with cleaner constructor injection.
All the examples in https://github.com/slodge/MvvmCross-Tutorials/ and in the N+1 videos have been updated to use the newer APIs.
For a full explanation of v3's service location and IoC see: Instantiation of ViewModels and Service classes
Related
I'm building a suite of REST micro-services using .Net Core 3.0 Preview 6. All these services will have the same start up logic. So, I'm trying to place all the code in a .Net Standard library.
The goal is to have the IHostBuilder:CreateHostBuilder method, as well as the Startup:Configure and Startup:ConfigureServices class and methods in the library. The library will also contain error handling logic, customized http response messages, etc.
However, I can't seem to find the correct package that contains the ConfigureWebHostDefaults method. I tried adding the Microsoft.AspNetCore package 2.2.0, but that didn't resolve the issue.
I added the Microsoft.Extensions.Hosting (3.0.0-preview-6) package, that also doesn't resolve the issue.
Is what I'm attempting even possible?
Thanks
-marc
I resolved it, not the best way, but it works. I decided to make the library targeted specifically for .NET Core 3.0. So, I changed the targetframework in the project file. That change automatically resolved my other issue.
Import the Microsoft.AspNetCore package, and use WebHost.CreateDefaultBuilder() instead. According to the code it is built from, both CreateDefaultBuilder() and ConfigureWebHostDefaults() call the same internal method: ConfigureWebDefaults().
The only downside of this is that the returned host will be an IWebHost instead of an IHost.
I'm new with Angular. I follow a tutorial from this link, and i tried to do/add something that doesn't part of that tutorial. I added a providers :[EmployeeService] line to employee-list.component.ts and empployee.component.ts inside #component, and it returns error that said TypeError: Cannot read property 'push' of undefined. So realize that adding providers :[EmployeeService] to some components are unnecessary. I read about Dependency Injection from this link but i do not really get what i wanted to know. So can anyone give me a simple explanation how/when/where to use/put providers and how that error happens?
Thank you very much in advance.
providers array tells Angular what services it should instantiate. You can define it on two places:
component
module
When you use providers in component the service will be available to that and all it's children.
When you use it in module the service will be available for all pipes, directives, components and services in given module.
But you can define it in both if you want - in that case Angular will create two instances of the same service.
For beginning provide your services on the module level.
Love this framework thus far.
That said, hit my first roadblock. I have created an MvvmCross-based library (actually a few libraries) that performs login services that will be used across multiple cross-platform applications of the same family. What I can't quite figure out is how to plug these login libraries into my other applications (which will also be using MvvmCross). I want to be able to re-use the same ViewModels and Views across these apps.
Assume that I've read and watched a lot of slodge's videos. :) Which are very good.
I think MvvmCross with two core libraries was about the closest thing to what I'm trying to do, which is just smash MvvmCross projects together and make it all magically work. But going by that post, which had some inconsistencies in the code samples, I've been unable to get this working.
There are 2 methods in Setup which tell mvvmcross where to look for Views and ViewModels. If you override these then the system should find your views and view models.
protected virtual Assembly[] GetViewAssemblies()
{
var assembly = GetType().Assembly;
return new[] {assembly};
}
protected virtual Assembly[] GetViewModelAssemblies()
{
var app = Mvx.Resolve<IMvxApplication>();
var assembly = app.GetType().Assembly;
return new[] {assembly};
}
Beyond this, the only additions to this that I'm aware of are that you might need:
to give wp some extra help in finding the xaml urls for any views which are in additional assemblies - by default mvx only looks for the xaml uri in /views, not in any other folder in any other assembly. One way to provide the xaml urls is to add a MvxPhoneViewAttribute within the View's c# file, another is to override the MvxPhoneViewsContainer to make it provide custom urls.
to adjust some of the android project settings in order to get resources shared from libraries to main project (although this functionality has gotten much better within xamarin.android this year.
I'm trying to recreate the sample provided on the castle windsor wiki about channel action policies (found here: http://docs.castleproject.org/Windsor.WCF-Facility-Channel-Action-Policy.ashx ) but i can't seem to find IChannelActionPolicy interface in the Castle.Facilities.WcfIntegration namespace anywhere.
I've installed the wcf facility via Nuget.
What am i doing wrong here?
The documentation is outdated in this regard. Have a look at IWcfPolicy interface and its implementors
How to correctly call my code when Glassfish v3.x is READY or going to SHUTDOWN?
I was succesfully using lifecycle listener on glassfish v2.x.
Unfortunatelly, this interface is marked as DEPRECATED in Glassfish v3.x. A new interface Startup is recomended instead but I don't know how to use it and could not find any useful documentation or examples. Could you please point me to how use it?
You want what's called a lifecycle module. Chapter 12, Developing Lifecycle Listeners is a good place to start. This explains the available events and when they fire. Once you have your class codded and ready to go this blog entry will explain how to deploy the module to GlassFish using the admin console..