Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "BobIngham"

Hi @demirmusa, let's go one step at a time. Can I upgrade my .NET framework to 4.7.1 without causing any breaking changes to .NET Zero? Are there any known issues?

Once we've established this I'll ask how to put AppConfig service into Startup.cs.

I managed to get it working with angular. Where does the problem lie?

I never worked this out. When you compile in angular you would expect the chunk names to change thus cache-busting, but it doesn't. In addition all of the files in the assets folder remain static so if there are changes to images it's likely you'll get the old ones. Hope that helps but if you can find a solution do post back.

@joynext, check your appsettings,json file in angular. I often see this when I'm using staging and testing slots, it's usually a config problem so could also be a connection string problem.

Hi @demirmusa,

Not for the purposes of this exercise - are you mad!!!! I'm still on 6.8.0 .NET framework 4.6.1. Can I upgrade to 4.7.1. Once upgraded how do I implement the Microsoft.Extensions.Configuration.AzureAppConfiguration in Zero 6.8.0? The instructions above are for explanatory purposes only.

dotnet core, .net framework 4.6.1, angular, Zero 6.8.0 I would like to move my connection strings to Azure's App Configuration service. I'm not that good down in the magic of how Zero works and I'm scratching my head on how to implement the nuget package Microsoft.Extensions.Configuration.AzureAppConfiguration. Firstly, all advice points to upgrading to .aspnet framework 4.7.1 - am I safe to do this with Zero?

Zero's startup.cs looks as follows:

        public static IWebHostBuilder CreateWebHostBuilder(string[] args)
        {
            return new WebHostBuilder()
                //.CaptureStartupErrors(true)
                //.UseSetting("detailedErrors", "true")
                .UseKestrel(opt => opt.AddServerHeader = false)
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>();
        }

Instructions for ASPNET Core 3 tell me to modify code as follows:

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
    .ConfigureWebHostDefaults(webBuilder =>
    webBuilder.ConfigureAppConfiguration((hostingContext, config) =>
    {
        var settings = config.Build();
        config.AddAzureAppConfiguration(settings["ConnectionStrings:AppConfig"]);
    })
    .UseStartup<Startup>());

Or this for .NET Core 2:

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .ConfigureAppConfiguration((hostingContext, config) =>
        {
            var settings = config.Build();
            config.AddAzureAppConfiguration(settings["ConnectionStrings:AppConfig"]);
        })
        .UseStartup<Startup>();

Instructions for .NET framework say I should be adding the following to my App.config file but I don't have an App.config file.

<configSections>
    <section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false" />
</configSections>

<configBuilders>
    <builders>
        <add name="MyConfigStore" mode="Greedy" connectionString="${ConnectionString}" type="Microsoft.Configuration.ConfigurationBuilders.AzureAppConfigurationBuilder, Microsoft.Configuration.ConfigurationBuilders.AzureAppConfiguration" />
        <add name="Environment" mode="Greedy" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment" />
    </builders>
</configBuilders>

<appSettings configBuilders="Environment,MyConfigStore">
    <add key="AppName" value="Console App Demo" />
    <add key="ConnectionString" value ="Set via an environment variable - for example, dev, test, staging, or production connection string." />
</appSettings>

I'm a little confused and admit to not being the best at this level. Can anyone point me in the right direction for adding Azure App Configuration to Zero 6.8.0?

Hi Aaron, As always you were correct. After I had properly registered by service in Startup.cs by using the namespace evenything worked. Fantastic, I have been looking for a way of implementing CQRS with Zero for a long time and this will definitely help with Azure function apps. If anyone is interested in the SQRS model for Azure Queue Storage I can recommend the following three videos on YouTube: Azure functions with Queue Storage Aaron, thanks again for stepping me through. Always a pleasure and good to see you working in Zero fold again!

Hi Aaron, The using statement is one thing but the other is how to call the method. To do that i need t oinject the service. Let's say:

using AzureQueueLibrary.Infrastructure;
...

private readonly IQueueCommunicator _queueCommunicator;

public TenantAppService(IQueueCommunicator, queueCommunicator)
{
    _queueCommunicator = queueCommunicator;
}
...

I can't invoke my _ queueCommunicator because it hasn't been injected.... Sorry for my poor coding and lack of knowledge, it's one reason why i use Zero in the first place.... Any sample code would be most appreciated.

dotnet-core, angular 6.8.0 Hi Guys, I'm not the best with dependency injection and this one has me scratching my head. I have a CQRS class library used by Zero and also by an Azure function app for Azure Queue Storage. My communicator class looks as follows:

using Microsoft.WindowsAzure.Storage.Queue;
using Nuagecare.AzureQueueLibrary.Messages;
using Nuagecare.AzureQueueLibrary.MessageSerializer;
using System.Threading.Tasks;

namespace Nuagecare.AzureQueueLibrary.QueueConnection
{
    public interface IQueueCommunicator
    {
        T Read<T>(string message);
        Task CreateDefaultDocumentCollectionForTenantAsync<T>(T obj) where T : BaseQueueMessage;

    }
    public class QueueCommunicator : IQueueCommunicator
    {
        private readonly IMessageSerializer _messageSerializer;
        private readonly ICloudQueueClientFactory _cloudQueueClientFactory;

        public QueueCommunicator(IMessageSerializer messageSerializer,
            ICloudQueueClientFactory cloudQueueClientFactory)
        {
            _messageSerializer = messageSerializer;
            _cloudQueueClientFactory = cloudQueueClientFactory;
        }

        public IMessageSerializer MessageSerializer { get; }

        public T Read<T>(string message)
        {
            return _messageSerializer.Deserialize<T>(message);
        }

        public async Task CreateDefaultDocumentCollectionForTenantAsync<T>(T obj) where T : BaseQueueMessage
        {
            var queueReference = _cloudQueueClientFactory.GetClient().GetQueueReference(obj.Route);
            await queueReference.CreateIfNotExistsAsync();

            var serializedMessage = _messageSerializer.Serialize(obj);
            var queueMessage = new CloudQueueMessage(serializedMessage);

            await queueReference.AddMessageAsync(queueMessage);
        }
    }
}

I want to call the CreateDefaultDocumentCollectionForTenantAsync() method from within a Zero application service but I'm having problems injecting the IQueueCommunicator class in my Zero application module. Inside my CQRS AzureQueueLibrary I have a DependencyInjectionRegistry class as follows:

using Microsoft.Extensions.DependencyInjection;
using Nuagecare.AzureQueueLibrary.Infrastructure;
using Nuagecare.AzureQueueLibrary.MessageSerializer;
using Nuagecare.AzureQueueLibrary.QueueConnection;

namespace AzureQueueLibrary.Infrastructure
{
    public static class DependencyInjectionRegistry
    {
        public static IServiceCollection AddAzureQueueLibrary(this IServiceCollection service, string queueConnectionString)
        {
            service.AddSingleton(new QueueConfig(queueConnectionString));
            service.AddSingleton<ICloudQueueClientFactory, CloudQueueClientFactory>();
            service.AddSingleton<IMessageSerializer, JsonMessageSerializer>();
            service.AddTransient<IQueueCommunicator, QueueCommunicator>();
            return service;
        }

    }
}

How do I register this class library in Zero? I thought maybe I could inject into Web.Host Startup.cs:

services.AddAzureQueueLibrary(_appConfiguration["ConnectionStrings:AzureStorage"]);

But AddAzureQueueLibrary is not part of IServiceCollection even after the class library has been added as a dependency. Normally with a class library I would inject to my ApplicationModule as follows:

            Configuration.ReplaceService(typeof(IDocumentProcessor), () =>
            {
                IocManager.IocContainer.Register(
                    Component.For<IDocumentProcessor>()
                        .ImplementedBy<DocumentProcessor>()
                        .LifestyleTransient()
                    );
            });

But this is different not least because it needs _ appConfiguration["ConnectionStrings:AzureStorage"] to be passed along to it when it is injected.

Any help gratefully received!!!!

Hi @ryancq - the function app reads the db directly. I will create a new call in the API and use pulic/secret keys. Thanks for the advice, I'll close this issue.

Showing 171 to 180 of 619 entries