Migration from Prism 7 to Prism 8 - migration

I'm trying to upgrade from Prism 7.1.0.431 to 8.1.97 and I'm having several problems.
I think my biggest problem comes from replacing the "CommonServiceLocator.ServiceLocator.Current" with "Prism.Ioc.ContainerLocator.Container."
(I know this is an anti-pattern,... but that's not the point)
I don't know how to replace : ServiceLocator.Current.GetAllInstances<>()
For example in this line of code where I get all the rights available in the application (in modules) that should be assignable to users:
IEnumerable rights = ServiceLocator.Current.GetAllInstances<CheckNavigationRights>().SelectMany(c => c.Rights).Distinct();
How can I do the same thing with Prism 8?
I use Unity.
Thank you very much for your help.

If you don't like Prism's container abstraction, you can use the container-specific static method GetContainer to get access to the underlying container:
using Prism.Unity;
IEnumerable rights = ContainerLocator.Container.GetContainer().GetAllInstances<CheckNavigationRights>().SelectMany(c => c.Rights).Distinct();
BTW: you could inject or resolve an IEnumerable<CheckNavigationRights> to get all the named registrations.

Related

Cumulocity - get access to datapoint modal

I'm trying to get an access to datapoints in new cumulocity version. In older version such things as c8yDataPointSvc and schemaPropertiesSvc. I can't seem to find them anywhere. Basically I need components to work with datapoint as in the picture below. I would appreciate any info on how to either reuse those old components or a new way of using them as there is such.
Thanks a lot!
I see here three options. First what I am going to say is that we in Cumulocity use a hybrid approach for our core applications, since we have a lot of functionalities still written in AngularJS. Same as the one that you need. There is no equivalent in Angular yet. That is why you have several options to use those old services.
One is in a hybrid application to you a bridge service where you can define the upgraded c8yDataPointSvc like that -
constructor(
private ng1Injector: any,
...
) {}
get ng1DataPointSvc() {
return this.ng1Injector.get('c8yDataPointSvc');
}
This ng1Injector is a constructor input variable that we define when we provide that bridge service in the upgrade module like this:
{
provide: BridgeService,
useFactory: BridgeFactory,
deps: ['$injector', ...]
}
This way you will still have an Angular application, you will still use the provided from us factory c8yDataPointSvc in your Angular application just by upgrading it using anguar hybrid app upgrade functionality.
Other option is to just keep your widget an AngularJS one and when you have a hybrid app, you can just import the AngularJS widget and the angular compiler will take care of the upgrade/downgrade. This is what we are doing with a lot of our customers, who have angulatJS widgets and are using Cumulocity versions above 10.5.0.*
And the last option will be to not use the AngularJS services you need and using our SDK just implement the functionalities used from c8yDataPointSvc. But that will be the biggest effort probably.

Failure in creation of feature class: Unable to create object class extension COM component

I am working with ArcGIS 10.5, installed on-premise, and are developing our feature class in .NET.
I have an issue with registering feature classes. We have created a Feature Class and registered the DLL through “ESRIRegAsm.exe”, and it appears in ArcCatalog:
Trigger appearing image
But when I try to create the Feature Class, I get the following error:
Failed to create feature class. Unable to create object class extension COM Component
Which isn't very helpful, unfortunately.
The odd thing is, that we have another trigger registered on another Feature Class, that works as expected. And the new trigger is based on a copy of the old trigger's code (with changed GUID's).
The steps I have done so far:
I have tried to add the feature class to the component category using categories.exe.
Registered it using ESRIRegAsm.exe for both Desktop and Engine.
Checked that there are .ecfg config files - and there are.
Checked that the CLSID's appear in the windows registry.
The essential parts of our trigger source-code can be found here: here.
Any help would be greatly appreciated, as we are stuck on this.
Our issue was that our ID's were wrong in the code.
The ClassExtensionCLSID should return the same ID as TriggerExtension has.
Moreover, InstanceCLSID should always return 52353152-891A-11D0-BEC6-00805F7C4268, and should hence not get a new ID.

SQLite.Net-PCL in Metro App using VB.NET - missing classes

I have included SQLite.Net-PCL v2.3.0 in my Metro app but it seems some classes are missing.
Dim MyPlatform = new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT()
Using connection = New SQLiteConnection(MyPlatform , _dbPath)
End Using
**SQLite.Net.Platform.WinRT.SQLitePlatformWinRT** class is not recognized.
Tried adding SQLite.Net.Platform.WinRTfirst but no success. IT says:
"To use this package you will need to install one of the platform packages or write your own implementation of ISQLitePlatform." (taken from https://www.nuget.org/packages/SQLite.Net.Platform.WinRT/)
What does it mean to implement my own interface ? I know my platform is WinRT, why can't I just use that version?
Any sample code or solution for this ?
You have to download and copy the sqlite3.dll in all the projects. See the following documentation:
https://sqlitepcl.codeplex.com/documentation
It will explain for each type of project

Issues with M:1 relations using Objectify 1.1rc and CRUD on Play 1.1

I'm having a really odd issue and maybe one of you can shed some light
on it. I would appreciate it :)
I'm developing an application using Objectify 1.1rc module for Play! Framework 1.1. I have 2 related objects whose relevant parts are:
public class User extends ObjectifyModel<User> {
[...]
public List<Key<Theatre>> theatres;
[...]
}
public class Theatre extends ObjectifyModel<Theatre> {
[...]
}
Some background:
I'm using Objectify 1.1rc from the Google code repository (the module in Play repository seems to fail with Play! 1.1) The sample application works fine
I based the objects in existing objects working properly on the sample application provided with the Objectify-1.1rc module for Play Framework (Showcase).
I did debugging and testing by pointing my application and the sample application (Showcase) to the same CRUD module.
I can link them using Java code without any problem.
Presently I have 2 issues that I cannot solve, which are:
M:1 relation not being saved
I have an issue with the 'theatres' relation from the User class. When editing an
object of type User via CRUD, I can see the multi-select control to relate Theatre instances to the User, When I click on some (one or more) of them and save the object, the relation is not saved, making it impossible to link the objects via the CRUD interface.
How can make it work?
CRUD code not being accessed by one application but accessed by the other
The sample application from Objectify module (Showcase) allows me to save M:1 relations using CRUD. As I mentioned before, both my application and showcase point to the same CRUD module, so they should use exactly the same code. What I noticed, by debugging via Log outputs, is that my application uses CRUD, but the sample application uses all the code up to a certain point.
The CRUD module traverses to 'tag/form.html', finds a field of type 'relation' (in both my code and the sample application) but when calling the tag '#{crud.relationField}' something odd happens: my application goes into the tag defined in the CRUD module. The sample application doesn't access that code, no logs added to that tag are triggered (at any point of the file).
I've searched for any replacement of the tag in the sample application, but I'm unable to find one. As you can guess, it's driving em crazy and making me start believing in green leprechauns living in my desktop (without giving me the gold, damn them!)
Anyone knows why does this happen? And were can I find the code being executed by the sample application? Finding it would most likely solve the issue #1
Thanks a lot!
Ok, found the issue to #1. I had a method called "getTheatres()" (should have had another name, was an error) and that was breaking the CRUD. Renaming the method solve issue #1.
I still didn't find why #2 was happening, but I believe I'll leave as one of those "worked in my computer" issues so common in our world...

ArcObjects - IWorkspaceExtension and Component Category Registration

I have coded an implementation of IWorkspaceExtension (along with IWorkspaceExtensionControl, which declares the Init method), and registered it in the ESRI Geodatabase Workspace Extensions Component Category. However, when I connect to the Workspace, the Extension is not "Init"ed.
I was able to get the implementation "Init"ed when I register the IWorkspaceExtension with the Geodatabase, but that is not an option because I cannot install the Extension on all clients, only on the one that will use the functionality.
I hope someone can answer in a couple of minutes what I have been struggling with for a couple of days. =D
Thanks.
Did you register it with IWorkspaceExtensionManager.RegisterExtension?
http://resources.esri.com/help/9.3/ArcGISEngine/dotnet/d50974a4-d67a-4cf0-9041-20cdb9f3a052.htm#GDBReg
Keep in mind that without the DLL, or if the DLL crashes, you will not be able to open the workspace. This wouldn't be a problem if ESRI allowed assemblies to be stored in the geodatabase, the way SQL Server does.