Base solution for your next web application

Activities of "piapps"

Hi alper,

Yep already created the module and I figured out the issue, it was that the UserConfigurationManager needs to actually be called to intialise the app context before any view model or anything using app context is called. It is done in droid in the SplashActivity but for iOS in the main shared project App.xaml.cs. I added a clause for UWP in the App.xaml.cs of the shared project too and it resolves the properties as expected.

There are other issues in the UWP project in relation to look and design but at least it runs so now I can focus on that.

Appreciate the help too thanks

Hi alper,

Yes I did see that post and used it to piece together some of the requirements to get the UWP project started. My problem is related to appContext being null when trying to load the LoginViewModel. I cant see how it relates to AsyncCommand at all?

I believe that appContext is being resolved before its properties are assigned

Regards, Pete

Hi guys,

So I am in the process of trying to create a UWP project in the mobile solution, everything compiles when it runs I am getting a null exception at line 56 of LoginViewModel in Mobile.Shared\ViewModels\LoginViewModel

It appears everything under applicationContext is null (applicationContext.Configuration etc), i have a feeling that maybe the DI is not working correctly or something like that but I am having trouble trying to see exactly what is wrong

My UWP is just a blank UWP that I have added a Locale.cs to (to match the other mobile projects), then added references to Application.Client Application.Shared Core.Shared Mobile.Shared

It wouldnt compile without all 4 even though only 2 are needed, also has Flurl and Flurl.Http, Xamarin.Forms (same versions as the other projects) The MainPage.xaml.cs has this.LoadApplication(new App()); added to the ctor and inheritance to Page removed from the class while WindowsPage was added to the xaml markup App.xaml.cs has had the following added to the OnLaunched event

ApplicationBootstrapper.InitializeIfNeeds<NAMESPACEXamarinUWPModule>();

AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;

base.OnLaunched(e); //Xamarin.Forms.Forms.Init(e); global::Xamarin.Forms.Forms.Init(e);

ImageCircleRenderer.Init(); CachedImageRenderer.Init();

ConfigureFlurlHttp();

and the App.xaml.cs inherits from Windows.UI.Xaml.Application

So I think either the App.xaml is inherting maybe from the wrong thing or OnLaunched might be wrong event perhaps or I need more references in the project to fix up the applicationContext null thing but im not really sure can anyone help?

Regards, Pete

I think I have it resolved but am just getting it retested by client at moment, i had set everything to default to English (Australia) which is required, but it wouldnt select the language no matter what we did. However I read somewhere else (cant remember where) that someone had to create a en-AU.xml file and thats what i have done and it does seem to work now.

I am not 100% sure why that helps but i will keep you posted if it fixed the issue or not

I am having a similar problem in Azure, my local works fine, but on the production server the language switch is not being obeyed. Doesnt matter what I click it will not change language, the request header looks correct and when a cookie does appear (i have deleted them a few times to see if it helps) it also looks correct.

The application is still sending different text back though, i even disabled all but two languages and changed the culture code on the 2nd language (that was always being selected) to something else so it would hopefully pick the default of the tenant, it however still picks the wrong language.

Checking the db table settings gives me various results and im not sure what is actually supposed to be in there, whenever I pick the language of the default tenant I am getting no record in there. Other times there is a null value in there, niether seems correct to my eyes but that doesnt mean its wrong if it was basing on the tenant default then that would be acceptable. I am starting to think maybe the culture header is being stripped from my requests and thus being ignored but I can not find any documentation to support that claim by Azure.

Anyone got any ideas?

Thanks for the suggestion maliming i didnt realise that with zero hangfire is fully setup to go already i just had to toggle the variable in WebConsts and replace the service in Web Module and was up and running.

Works great, I turned the WebConsts flag into an app setting and added a setting for worker count because 20 was too CPU heavy per instance and it now works great.

Thanks for making it easy!

I will have a look thanks

I was going to check that out as well but still wondering if my solution above is viable?

Hi guys,

We have ASPNet Zero solution running in two Azure App Services spread over 2 geographic locations and it works well, however both instances are running the same background jobs im guessing because the job query transaction is not blocking reading of the same rows.

So my question is can I simply implement my own background job store to lock the reading of rows (in effect making it only one instance can read any single job at a time) and fix the issue. Or is it more systemic than that and I would need to adjust other layers of the background job code?

I do want the ability for multiple instances to process jobs just not the same jobs, our project will probably end up scaling up to 3-6 instances over the coming months with one of the purposes to utilise the job system accross all of them

Thanks in advance

I have been playing around with wanting to do this myself too and just havent had time. I dont believe there is anything done by the zero team yet.

My thoughts are 3 levels of permissions for an entity

  • Any/All
  • Owner/Admin
  • Member (or user connected to entity)

So in principle you would setup CRUD permissions per each of the above EntityName.Any.Create EntityName.Any.Edit EntityName.Any.Delete

EntityName.Own.Edit EntityName.Own.Delete

EntityName.Member.Edit EntityName.Member.Delete

Then inherit from RepoBase with something like EntityPermissionCheckedRepositoryBase and overload/overwrite the repo methods you want to confirm permissions on for example if we had a Customer entity that had users who could view it (but not all users) you might have something like this

public override IQueryable<Customer> GetAll() { var query = base.GetAll(); if (!_permissionChecker.IsGranted(AppPermissions.Pages_Customers_Any)) { //if they cant see all then they are limited to ones they are a member of query = (from c in query join cu in Context.CustomerUsers on c.Id equals cu.CustomerId where cu.UserId == Context.AbpSession.UserId select c); } return query; }

 So the above will get the normal query from standard repo base.
 If the user is not allowed to see all customers then it will add a where clause to the entity to join with a table
 that says who cant see what and select the customer entity at the finish. This will basically mean that
 anyone with the Any permission can see all, while those without can only see ones they are connected with.
 
 You could then potentially make this generic using interface types and you could even go as far as create a generic entity to replace CustomerUsers (store the entity type name and entity id) and it could map to any entity.
 
 For insert/update/delete type permissions you would need to inherit permission checker and expand it to
 pass in entity you are checking against then check like above and throw error or fail silently. You could also
 cache the check result to stop unnecessary round trips during those operations
    

Im not suggesting this is the right way to go and i certainly havent had time to flesh it out properly but its a way i was thinkgin about. You could use an entityframework filter too like they do with tenant id

Showing 1 to 10 of 25 entries