Base solution for your next web application

Activities of "devinedon"

Thanks, I see from https://support.aspnetzero.com/QA/Questions/9129/Signal-R-send-custom-messages-to-Client-Side-using-azure-functionBlob-Triggered you say its supported from 8.6 and up. Is there any documentation to help me get going faster from ANZ?

Hey,

no javascript errors :/

If it means anything, the chat works perfectly. Pushes through perfectly.

Is it not problematic that Im triggering the push from a 3rd party application (Azure Function CosmosDB trigger)?

using (var obj = Startup.iocManager.ResolveAsDisposable<AzFunctionAbpExecuter>())
{
    await obj.Object.AddNewDeviceEventAppNotifier(deviceData);
}
public class AzFunctionAbpExecuter : ITransientDependency
{
    private readonly IRepository<Tenant> _tenantRepository;
    private readonly IAppNotifier _appNotifier;

    public AzFunctionAbpExecuter(IRepository<Tenant> tenantRepository, IAppNotifier appNotifier)
    {
        _tenantRepository = tenantRepository;
        _appNotifier = appNotifier;
    }

    public async Task AddNewDeviceEventAppNotifier(SynapWare.CosmosDB.DeviceData data)
    {
        await _appNotifier.NewDeviceEventAsync(data);
    }
}
public async Task NewDeviceEventAsync(DeviceData deviceData)
{
    var notificationData = new LocalizableMessageNotificationData(
        new LocalizableString(
            "NewDeviceEventNotificationMessage",
            SynapWareConsts.LocalizationSourceName
        )
    );

    notificationData["deviceSerial"] = deviceData.Serial;
    if (deviceData.aimEventData != null)
    {
        notificationData["eventType"] = deviceData.aimEventData.deviceEventDataType.ToString();
    }

    UserIdentifier user = new UserIdentifier(null, userId: 1);
    await _notificationPublisher.PublishAsync(AppNotificationNames.NewDeviceEvent, notificationData, userIds: new[] { user });
}

Thanks for putting this together! Really appreciate it. Will see if it does this for default notifications such as new user registrations etc... Will get back to you ASAP

EDIT: Even new users registering dont show.. but strangly they dont even show in the Notifications page? Should they? "On a new user registered to the application." It is written to AbpNotifications

ANC : 9.3.0

Hey,

Everything else works really well! From ingesting data into tables (via appNotifier) to showing on the UI.

The only remaining issue as per subject; am I doing something wrong to warant a page refresh in order for badge to update?

Got it working :) Like I stated in previous comment, answer lies within the migrator project. If anyone wants me to post some sample code let me know and I will do that.

Hey, thanks for the reply

It seems like its still ongoing :/ https://github.com/abpframework/abp/issues/527 With Dependency Injection its now most likely possible for Azure Functions https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection

Do you have any ideas how I could convert my azure function into an ABP Module? Here is my onConfigure so far

`using Microsoft.Azure.Documents.Client; using Microsoft.Azure.Functions.Extensions.DependencyInjection; using Microsoft.Azure.WebJobs.Host.Bindings; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using SynapWare.Configuration; using SynapWare.CosmosDB; using SynapWare.Notifications; using System; using System.Collections.Generic;

[assembly: FunctionsStartup(typeof(SynapWare.AzureFunction.IoT.Startup))] namespace SynapWare.AzureFunction.IoT { public class Startup : FunctionsStartup { private IConfigurationRoot _appConfiguration; private DocumentClient _documentClient;

    public override void Configure(IFunctionsHostBuilder builder)
    {
        var executioncontextoptions = builder.Services.BuildServiceProvider().GetService<IOptions<ExecutionContextOptions>>().Value;
        var currentDirectory = executioncontextoptions.AppDirectory;
        //_appConfiguration = AppConfigurations.Get(Environment.CurrentDirectory);
        _appConfiguration = AppConfigurations.Get(currentDirectory);

        var serviceEndpoint = new Uri(_appConfiguration.GetValue<string>("LatestDeviceDataCosmosDb:ServiceEndpoint"), UriKind.Absolute);
        var authKey = _appConfiguration.GetValue<string>("LatestDeviceDataCosmosDb:authKey");
        var databaseName = _appConfiguration.GetValue<string>("LatestDeviceDataCosmosDb:DatabaseName");
        var collectionName = _appConfiguration.GetValue<string>("LatestDeviceDataCosmosDb:CollectionName");
        var collectionNames = new List<string>();
        collectionNames.Add(collectionName);

        var jsonSer = new JsonSerializerSettings
        {
            NullValueHandling = NullValueHandling.Ignore,
            DefaultValueHandling = DefaultValueHandling.Ignore,
            ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() }
        };
        _documentClient = new DocumentClient(serviceEndpoint, authKey, jsonSer);
        _documentClient.OpenAsync().Wait();
        var cosmosDbClientFactory = new CosmosDbClientFactory(databaseName, collectionNames, _documentClient);
        cosmosDbClientFactory.EnsureDbSetupAsync().Wait();
        builder.Services.AddSingleton<ICosmosDbClientFactory>(cosmosDbClientFactory);

        var connectionString = _appConfiguration.GetValue<string>("NotificationHubSettings:FullAccessConnectionString");
        var notificationHubPath = _appConfiguration.GetValue<string>("NotificationHubSettings:NotificationHubName");
        var notificationHub = new NotificationHubManager(connectionString, notificationHubPath);
        builder.Services.AddSingleton<INotificationHubManager>(notificationHub);

        //IocManager.RegisterAssemblyByConvention(typeof(Startup).GetAssembly());
        //builder.Services.AddSignalR();
        //builder.Services.AddHttpClient();
        ////endpoints.MapHub<AbpCommonHub>("/signalr");
        //builder.Services.AddSingleton<INotificationPublisher, NotificationPublisher>();
        //builder.Services.AddSingleton<IAppNotifier, AppNotifier>();
    }
}

} ` Assuming whatever magic will happen here. I need to register IoCManager manually?

EDIT : Following Migrator project at the moment. Hopefully can sneak it into a using

using (var bootstrapper = AbpBootstrapper.Create<ABCModule>())

Currently running : ANZ 9.3

We currently heavily use Azure for our pipeline. We have logic within an Azure Function that does Azure Push Notifications so would love to also send to the web to notify users via AppNotifier here as well.

There is probably a much larger requirment but what is needed to push messages outside of web host? I am battling to access AppNotifier (Object reference).

The FunctionStartup Configuration - where I attempt to DI IAppNotifier? :shrug :

The function constructor:

Error within AppNotifier:

Any help would be appreciated. I am assuming Im misunderstanding a key understanding regarding the signalR notification system and what is possible.

Hi,

I managed to get this working - thanks for the assistance.

Hi,

As a follow up to post #9763, as an alternative option I thought of (but which I can't get to work!) is as follows:

  • Create a new DynamicEntityPropertyClass, which also inherits from IFullAudited, and then enable Entity History for FullAuditedEntities
    • https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Extending-Existing-Entities
[Audited]
    public class MyDynamicEntityProperty : DynamicEntityProperty, IFullAudited
    {
        public DateTime CreationTime { get; set; }
        public long? CreatorUserId { get; set; }
        public DateTime? LastModificationTime { get; set; }
        public long? LastModifierUserId { get; set; }
        public bool IsDeleted { get; set; }
        public long? DeleterUserId { get; set; }
        public DateTime? DeletionTime { get; set; }
    }

    Configuration.EntityHistory.Selectors.Add(
                new NamedTypeSelector("Abp.FullAuditedEntities", type => typeof(IFullAudited).IsAssignableFrom(type)));

After running the migration to generate the new table with the IFullAudited columns, the relevant columns are not updating e.g. when I add a new entity, the CreationTime and CreatorUserId are still null.

Is the above implementation possible, or am I going down an impossible route?

So sorry for the delayed repsonse.

ABP - 5.13 Automapper - 10

I think I already tried automapper version 10 to fix this - think this is why im on this instead of 9 for ANZ 9.2.0 RC1 (which is what currently on)

Showing 21 to 30 of 46 entries