Base solution for your next web application

Activities of "doubledp"

Hi,

Thank you for this. I have seen that post.

Not quite sure what Halil means by if you are not in a UOW there would be no problem. Another thing that I don't get is when I remove the inheritance of AppServiceBase my code works correctly.

I am hoping Halil can point me in the right direction.

Hi,

Could you please help me with the following:

I am trying to execute async calls is parallel and only use execute subsequent code after all the async tasks have been completed.

Here is the code:

public async Task<LabourSalesHighlightsDto> GetLabourSalesHighlights(LabourSalesAggregateInput input)
        {
            LabourSalesHighlightsDto labourSalesHighlights = new LabourSalesHighlightsDto();

            var labourSalesOperatorAggregateTask = GetLabourSalesAggregation_ByCompanyNumber_ByOperatorName(input);
            var labourSalesInvoicingAggregateTask = GetLabourSalesAggregation_ByCompanyNumber_ByInvoicing(input);
            var labourSalesCreditingAggregateTask = GetLabourSalesAggregation_ByCompanyNumber_ByCredits(input);

            await Task.WhenAll(labourSalesOperatorAggregateTask, labourSalesInvoicingAggregateTask, labourSalesCreditingAggregateTask);

            var labourSalesOperatorAggregate = labourSalesOperatorAggregateTask.Result;
            var labourSalesInvoicingAggregate = labourSalesInvoicingAggregateTask.Result;
            var labourSalesCreditingAggregate = labourSalesCreditingAggregateTask.Result;

            labourSalesHighlights.SalesTopTotal = labourSalesOperatorAggregate.Items.Select(lsa => lsa.Value).FirstOrDefault();
            labourSalesHighlights.SalesTopName = labourSalesOperatorAggregate.Items.Select(lsa => lsa.Label).FirstOrDefault();
            labourSalesHighlights.SalesTopDescription = labourSalesOperatorAggregate.Items.Select(lsa => lsa.CompanyName).FirstOrDefault();

            labourSalesHighlights.InvoicingTotal = labourSalesInvoicingAggregate.Items.Select(lsa => lsa.Value).Sum();
            labourSalesHighlights.InvoicingBestName = labourSalesInvoicingAggregate.Items.Select(lsa => lsa.Label).FirstOrDefault();
            labourSalesHighlights.InvoicingWorstName = labourSalesInvoicingAggregate.Items.Select(lsa => lsa.Label).LastOrDefault();

            labourSalesHighlights.CreditingTotal = labourSalesCreditingAggregate.Items.Select(lsa => lsa.Value).Sum();
            labourSalesHighlights.CreditingBestName = labourSalesCreditingAggregate.Items.Select(lsa => lsa.Label).FirstOrDefault();
            labourSalesHighlights.CreditingWorstName = labourSalesCreditingAggregate.Items.Select(lsa => lsa.Label).LastOrDefault();

            return labourSalesHighlights;
        }

When I don't inherit from AppServiceBase for this particular service, the code is working with the only exception that the audit log entry does not get created then.

When I inherit from AppServiceBase for this particular service, the execution of the above method results in an exception as per below:

System.NotSupportedException: A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe.

I want to inherit from AppServiceBase so that my method call gets logged to the Audit Log table.

Please help!

Ok it seems like I managed to track down what is causing this issue; the original layout's script doesn't seem to work correctly.

I have changed the code in AppBundleConfig as follows:

From

bundles.Add(
              new ScriptBundle("~/Bundles/App/metronic/js")
                  .Include(
                      "~/metronic/assets/global/scripts/app.js",
                      "~/metronic/assets/admin/layout/scripts/layout.js"
                  ).ForceOrdered()
              );

To

bundles.Add(
              new ScriptBundle("~/Bundles/App/metronic/js")
                  .Include(
                      "~/metronic/assets/global/scripts/app.js",
                      "~/metronic/assets/admin/layout4/scripts/layout.js"
                  ).ForceOrdered()
              );

This issue is not related to ASP.NET Zero, but rather the Metronic theme.

Hi,

It seems like I might have broken something during the upgrade. I went from version 1.5.0.0 to 1.7.0.0 (Quite a painful exercise I might add).

The problem I am experiencing now is that sidebar navigation does not expand when clicking on it. I have inspected the element that should contain items and the rendered HTML does contain those items, but the expansion does not happen.

Any ideas what the problem might be?

Thank you Halil :)

I've been playing around with different naming conventions and I understand now how it works. The thing that threw me off was thinking that I have to inherit from IApplicationService, not knowing that I can create my own interface and inherit from that.

After going back to the documentation I realize now that I did not read properly to understand it fully.

Sorry for the unnecessary question :oops:

Hi Halil, any advice on this?

Hi,

I am also fairly new to using the ASP.NET Zero template project and the ASP.NET Boilerplate framework so I will answer as best I can.

  1. Is there a guide for creating new pages accessed via the menu on the dashboard page in the MPA model? Are there any template pages to work with other than the dashboard page? Do I need to create new folders under the mpa/views or just new .cshtml pages within "dashboard"

Here is a link with a tutorial on developing the MPA version: [http://www.aspnetzero.com/Documents/Developing-Step-By-Step-MPA])

I develop using the SPA version, but I would imagine that there would also be pages for Users, Roles, Tenants, AuditLogs, etc for the MPA version. In terms of new folders; I would suggest that you do create separate folders for your different application function areas. This will keep your project structured and organised.

How do I add language-neutral/common language items to the navigation menu without having to use the L("item") function? For example, if I simply wanted the text "Microsoft" or "Symantec" as menu or item title?

L("string") is just a method that will translate the string based on your localization setup, so I am sure by omitting the call to the method, it will be treated as a normal string.

What is the version of the Metronic theme in the current ASP.NET Zero project? 4.5.2? I tried this version in my own environment and found that the datatables do not seem to render correctly anymore - the first column in the row does not highlight when you hover over a row.

Yes Metronic v4.5.2 is being used ASP.NET Zero v1.6.1 I can't speak for the use of datatables, as I am using ui-grid; so maybe the architect of this framework and project template could shed some light on this for you.

When I want to publish to a web server using VisualStudio, is it just the ProjectName.Web project I publish?

Can't really answer you on this one, as I am still in development and would also like to know what would happen to the WepApi assembly as the APIs gets generated dynamically. For the other assemblies I would imagine that they will be included in the Web assembly during the publishing of the project. Again the architect is best suited to answer this.

One thing could be a bit of a concern to you and that is that this framework and project template has been written in C#, so it might be a bit of struggle for you to get everything to work accordingly if you intend on using VB still. From what I understand is that you can mix C# and VB.Net, but only in the same solution, it cannot be part of the same assembly.

Thank you Halil :)

Have a great day!

Hi,

In the documentation regarding the Dynamic Web API layer, there is the mention of the following:

ITaskAppService is the application service that we want to wrap with an api controller. It is not restricted to application services but this is the traditional and recommended way. "tasksystem/task" is name of the api controller with an arbitrary namespace. You should define at least one-level namespace but you can define more deep namespaces like "myCompany/myApplication/myNamespace1/myNamespace2/myServiceName". '/api/services/' is a prefix for all dynamic web api controllers. So, address of the api controller will be like '/api/services/tasksystem/task' and GetTasks method's address will be '/api/services/tasksystem/task/getTasks'. Method names are converted to camelCase since it's conventional in javascript world.

Does that mean we should explicitly define every application service like the following, if we want it generate the APIs according to the namespace of where the interface is defined?

DynamicApiControllerBuilder.For<ITaskAppService>("/myNamespace1/myNamespace2/tasksystem/task").Build();

Or is there perhaps a more dynamic way of generating it as above? The reason I am asking is because I see that currently in the template's WebAPI assembly, the initialization is defined as follows:

DynamicApiControllerBuilder
                .ForAll<IApplicationService>(typeof(TemplateApplicationModule).Assembly, "app")
                .Build();

Thank you very much.

So does this then mean that the repository interface and implementation of it must reside within the Core assembly?

Currently I have the interface in the Core assembly and the implementation of it in the EntityFramework assembly. I am running into the problem of not being able to reference the custom repository in the core module class because of that.

What is the correct way to implement this?

Showing 11 to 20 of 50 entries