I'm looking for a way that I can get Simple Injector to locate services registered with the Xamarin Forms Dependency Service, when the services cannot otherwise be resolved by the Container. Is there a way to do this with Simple Injector?
Unregistered type resolution can be implemented using the Container.ResolveUnregisteredType event.
Do note however that you should take my warnings as stated in the comments very seriously. Your scenario is not a good case for unregistered type resolution.
Related
hi I read some msdn tutorial on Xamarin form but there is no mention of PlugIn. I am a bit confused as to which one to use. Dependency service is used to call the platform Specific Api such as TextToSpeech in iOS and Android. But there are Plugin for Camera, Toast, Location and others. It seems this approach is better.
I need some confirmation and understanding to clear this confusion.
1.Is PlugIn an alternative to Dependency service?
for Example , I dont have to use Dependency service for location in iOS and Android if there is a Location-Plugin for Xamarin.forms.
your confirmation will help me on this matter.
Thanks
The DependencyService is a method that is built into the Xamarin.Forms library to provide you with a way to implement platform-specific code. More information can be found in the documentation: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/
The plugins, now bundled as Xamarin.Essentials (but of course there are much more), actually might use this DependencyService or at least work in a very similar way.
There really is not one answer to choose one or the other. If there is a plugin that does what you need and you feel comfortable using it, then do! If you need something different, you might want to write something of your own.
Always have a good look at the state of the code for a plugin: is it actively maintained? Is it built by someone you would trust, etc.
I'm using a product that utilizes the Qt QWebPage class. I'm surprised I haven't seen posts, but I'm having trouble getting this to load a website that utilizes Windows Authentication. Does anyone know of any support to pass along credentials or load a page as the default user who is executing QT?
The question feels beyond Qt. To deal with Windows Authentication we can probably use QAuthenticator class but the applicability of it remains a question. You want to deal with web interface and use authentication? Then many more details needed and depending on those some specific programmatic solution can be applied. I assume you need to deal with HTTP/Form authentication as well and that needs to drive post/get requests. Somewhat similar answer. My current project involves many types of authentications and we have a specialist on the team just for that. It is all about network/application security logic.
Are you handling proxy inside your code. Also you must use Qt version 5.3 or greater to support NTLM authentication.
I'm using Caliburn micro with a WinRT application and it looks like that there's no StorageManager class, anyone has suggestions about how to persist application/ViewModels state in this case.
TIA
This is not related to Caliburn.Micro but rather a general issue. You can either use Serialization but then you will have to pay attention to versioning and changes in your view model or you could save the fields you are interested in to a file using the normal IO methods or even store your view models in the database if you wish (although i think this might be a bit extreme).
Edit: Caliburn.Micro isn't a business application framework and there have been no library that tried to integrate business functionality with CM as far as i know, so this leaves you with serialization as your best option but as i said ser/des comes with some nightmares you have to manage such as version changes, class changes, etc.
There's another project called Catel which is a business application framework that contains an MVVM framework, anyway Catel uses a nice object called DataObjectBase ( actually now it is called ModelBase) which solves all problems of serialization and there is an article for that on code project if you want to read it and see how they have done it.
If you wish you can use the Catel.Core module which is a library with a lot of features for data handling (it contains the ModelBase class) or you can take a look at the source code and see how they have solved the issue with ser/des and implement that with Caliburn.Micro in your project.
Do I need to implement all the required methods on the MembershipProvider and RoleProvider if writing a custom one to use the AuthorizedAttribute in ASP.NET MVC?
There are a few features that I don't want to implement like CreateUser or 'DeleteRole` because they violate the system I will be authorizing/authenticating against.
No, you don't need to implement everything if you never use this functionality. Throwing a NotImplementedException is always a good way to indicate this.
I am currently doing the same thing and you don't have to implement all the methods.
You might want to look at the following website.
http://theintegrity.co.uk/2010/11/asp-net-mvc-2-custom-membership-provider-tutorial-part-1/
Great tutorial for implementing a custom membership provider with ASP.NET MVC!
No you don't need to implement all methods for the MembershipProvider or RoleProvider; if you never use the API for creating, updating, or deleting, then you could throw an exception when used. These are there in case you do modify user data, and are also used by the Administration web site option in Visual Studio. So if you use that web site, it quite won't work as expected as it expects these provider methods to be present.
But if all you do is use the controls, then it would be handy to research which API methods these control use and make sure that you have implementations for those. What I mean is that Login control uses ValidateUser for sure, and may use GetUser too. It may also call UpdateUser to update the failed logon count, last login date, etc.
HTH.
I have been building web sites with ASP.NET for a while now. At first I avoided learning the intricacies of the ASP.NET Provider Model. Instead I used the canned providers where necessary, and leaned heavily on Dependency Injection frameworks for all my other needs.
Recently however, I have been writing pluggable components for ASP.NET and of course writing lots of custom provider based solutions in order to make that happen. It has become quickly apparent to me however, that a lot of initialization code is being duplicated, which is a bad thing.
So...
Are there any best practices that have emerged on how to avoid the configuration spaghetti code?
Have you built, or have any examples (base/helper classes, custom attributes, reflection) to share of abstracting the basic initialization code out so building custom providers is easier?
NOTE:
Please do not try and send me to the Provider Toolkit site. I have already exhausted that resource, which is why I am turning to the SO Community :)
I just did a rough implementation of rather basic implementation of the membership and role providers, and I don't have any code duplication at all!
I have divided everything into three projects (plus tests):
Application - asp.net mvc app. models, controllers etc.
Infrastructure - IoC and Interfaces
Infrastructure.Web - Providers
The model for User and Role implement interfaces from Infrastructure and those classes get registered to the IoC on application startup. The providers then asks the IoC to resolve the classes and does it's thing. This way I can add things to the model and user interface yet using the same providers. The one problem I've noticed, is that the web being launched by the "ASP.NET Configuration"-button can't use the providers, as the setup is being done in Application_Start and the "ASP.NET Configuration" is another web. I don't see this as a problem though.