Base solution for your next web application

Activities of "acrigney"

Question

Would you be able to give me an UpdateAsync example

I have this code.

public async Task<PatientBodyImage> PostSetPatientBodyImageStateAsync(PatientBodyImageInput input) {

        PatientBodyImage patientBodyImage = _patientBodyImageRepository.Get(input.Id);

        Logger.Debug("Setting  a new image state async: " + input.Name);
        
        var update = await _patientBodyImageRepository.UpdateAsync(input.Id, async (x) =>
        {
            await Task.Run(() => UpdateImageState(patientBodyImage, input));                
        });

        return (update);
    }

Havent tested it uet Love your work!!

Answer

Thats great about returning the DTO I forgot about that!

And also your code is much simpler.

I didn't want to use an automapper for the map from the DTO to the domain object so I was using a function as not all the fields would be set in this update case but you don't need to with your solution.

Awesome thank you!

Hi Guys, I have the abp framework being built using visual studio team services now and I just noticed that my builds are failing as it seems that my Abp 0.7.3.0 version has been removed from nuget? I had planned to upgrade before but the upgrade of all of my projects was not compatible as I had some web sites that would not upgrade due to incompatibilities. Did you remove the old versions? Can we keep them?

Best Regards, Alistair

Sorry mate I forgot to check that it just didn't come u[ when I ran this.

PM> Get-Package -ListAvailable -Filter Abp -AllVersions

Id Version Description/Release Notes


Abp 0.8.2.0 ASP.NET Boilerplate core package.
Abp.Application 0.3.2.0 IMPORTANT: This package is not used anymore. Use <a class="postlink" href="https://www.nuget.org..">https://www.nuget.org..</a>. Abp.AutoMapper 0.8.2.0 AutoMapper integration package for ASP.NET Boilerplate.
Abp.EntityFramework 0.8.2.0 EntityFramework integration package for ASP.NET Boilerplate.
Abp.FluentMigrator 0.8.2.0 FluentMigrator package for ASP.NET Boilerplate
Abp.HangFire 0.8.2.0 HangFire integration package for ASP.NET Boilerplate.
Abp.Infrastructure.EntityFr... 0.3.2.0 IMPORTANT: This package is not used anymore. Use <a class="postlink" href="https://www.nuget.org..">https://www.nuget.org..</a>. Abp.Infrastructure.NHibernate 0.3.2.0 IMPORTANT: This package is not used anymore. Use <a class="postlink" href="https://www.nuget.org..">https://www.nuget.org..</a>. Abp.Modules.Core 0.3.2.0 ASP.NET Boilerplate - Core Module
Abp.Modules.Core.Application 0.3.2.0 ASP.NET Boilerplate - Core Module - Application Layer
Abp.Modules.Core.Infrastruc... 0.3.2.0 ASP.NET Boilerplate - Core Module - Infrastructure - EntityFramework
Abp.Modules.Core.Infrastruc... 0.3.2.0 ASP.NET Boilerplate - Core Module - Infrastructure - NHibernate
Abp.Modules.Core.Web 0.3.2.0 ASP.NET Boilerplate - Core Module - Web Layer
Abp.Modules.Core.Web.Api 0.3.2.0 ASP.NET Boilerplate - Core Module - Web Api Layer
Abp.Modules.Core.Web.Mvc 0.3.2.0 ASP.NET Boilerplate - Core Module - MVC
Abp.NHibernate 0.8.2.0 NHibernate integration package for ASP.NET Boilerplate.
Abp.Owin 0.8.2.0 OWIN integration package for ASP.NET Boilerplate.
Abp.RedisCache 0.8.2.0 Redis Cache integration package for ASP.NET Boilerplate
Abp.Samples.Blog.Application 0.3.0.2 A sample blog module for ASP.NET Boilerplate.
Abp.Samples.Blog.Core 0.3.0.2 A sample blog module for ASP.NET Boilerplate.
Abp.Samples.Blog.EntityFram... 0.3.0.2 A sample blog module for ASP.NET Boilerplate.
Abp.Samples.Blog.Web 0.3.0.2 A sample blog module for ASP.NET Boilerplate.
Abp.TestBase 0.8.2.0 ASP.NET Boilerplate test base. Used to build unit/integration tests fo... Abp.Web 0.8.2.0 Web package for ASP.NET Boilerplate.
Abp.Web.Api 0.8.2.0 ASP.NET Web API integration package for ASP.NET Boilerplate.
Abp.Web.Api.OData 0.8.2.0 ASP.NET Web API - OData integration package for ASP.NET Boilerplate.
Abp.Web.Mvc 0.8.2.0 ASP.NET MVC integration package for ASP.NET Boilerplate.
Abp.Web.Resources 0.8.2.0 This package contains resources (xml, js and css files) needed for ASP... Abp.Web.SignalR 0.8.2.0 SignalR integration package for ASP.NET Boilerplate.
Abp.Zero 0.8.2.0 ASP.NET Boilerplate - Module Zero. Implements tenant, role, user and s... Abp.Zero.EntityFramework 0.8.2.0 ASP.NET Boilerplate - Module Zero - EntityFramework.
Abp.Zero.Ldap 0.8.2.0 ASP.NET Boilerplate - Module Zero - LDAP (Active Directory) Integration. Abp.Zero.NHibernate 0.8.2.0 ASP.NET Boilerplate - Module Zero - NHibernate Integration.
OneWork.AbpApplication 1.0.0.1 Description
OneWork.AbpWebMvc 1.0.0.2 Description

Sorry the problem was that I was not getting the nuget restore to work properly in Visual Studio Team Services. If the packages folder is present OR Even if you have one pending to checkin (i.e not actually checked in) then nuget restore will not restore. And you should not have a Nuget.Targets file and packages.config in your .nuget folder.

I updated all of my projects to .net 4.6.1 and updated all packages to the latest code and its all working really great, thanks very much!!

Question

Hi Guys, Love your work but we are unable to get our Azure reverse proxy setup to work. Its not a problem with ASP.NET Boilerplate its just a general MVC question. I just thought you could help us out 8-)

We have a root site xxx and the reverse proxy should redirect xxx/test to our real site <a class="postlink" href="http://blah.blah.azurewebsites.net">http://blah.blah.azurewebsites.net</a>

We have tried the fixes referenced here.

1 Fix for this now added to my AspNetBundling NuGet package which resolves a bunch of other issues in the standard transformer, particularly around using data-uris. Open-sourced on GitHub too.

Just do: 1.1 Install-Package AspNetBundling 1.2. Replace CssRewriteUrlTransform with CssRewriteUrlTransformFixed

  1. Using this CssRewriteUrlTransformWrapper public class CssRewriteUrlTransformWrapper : IItemTransform {
    public string Process(string includedVirtualPath, string input) { return new CssRewriteUrlTransform().Process("~" + VirtualPathUtility.ToAbsolute(includedVirtualPath), input); } }
  2. Using ResolveBundleUrl e.g with code like this <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/content/styles/css")" rel="stylesheet" type="text/css" />

Here is our route rule in our root web.config file for our root site in Azure. NB. This site only has a web.config configured.

<rule name="test" stopProcessing="true"> <match url="^test/?(.*)" /> <action type="Rewrite" url="http://blah.blah.azurewebsites.net/{R:1}" /> </rule> But all of our scripts and js bundles give 404 not found errors.

It would be really awesome if you could give us any advice, we have Microsoft working on it!!

Best Regards, Alistair

Hi Guys, Love your work! But I need to have a mock implementation of the database for the application just like you can with the base unit tests classes. I tested this out with your SimpleTaskSystem sample project.

I was wondering what you thought of this approach. I created a new project called SimpleTaskSystem.InMemoryData with a module SimpleTaskSystemInMemoryDataModule like this

using System.Reflection; using Abp.EntityFramework; using Abp.Modules; using Castle.MicroKernel.Registration; using System.Data.Common; using System; using SimpleTaskSystem.InMemoryData; using SimpleTaskSystem.EntityFramework;

namespace SimpleTaskSystem { [DependsOn(typeof(SimpleTaskSystemCoreModule), typeof(AbpEntityFrameworkModule))] public class SimpleTaskSystemInMemoryDataModule : AbpModule { public override void Initialize() { IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());

        IocManager.IocContainer.Register(
            Component.For&lt;SimpleTaskSystemDbContext&gt;()
                .Instance(SimpleTaskSystemInitialDataBuilder.Build(new SimpleTaskSystemDbContext(Effort.DbConnectionFactory.CreatePersistent("1"))))
                .IsDefault().Named("InMemoryData")                          
                .LifestyleSingleton()
            );
}

}

With a module class like this using System.Data.Entity.Migrations; using System.Linq; using SimpleTaskSystem.EntityFramework; using SimpleTaskSystem.People; using SimpleTaskSystem.Tasks;

namespace SimpleTaskSystem.InMemoryData { public static class SimpleTaskSystemInitialDataBuilder { public static SimpleTaskSystemDbContext Build(SimpleTaskSystemDbContext context) { //Add some people

        context.People.AddOrUpdate(
            p => p.Name,
            new Person {Name = "Isaac Asimov"},
            new Person {Name = "Thomas More"},
            new Person {Name = "George Orwell"},
            new Person {Name = "Douglas Adams"}
            );

        context.SaveChanges();

        //Add some tasks

        context.Tasks.AddOrUpdate(
            t => t.Description,
            new Task
            {
                Description = "my initial task 1"
            },
            new Task
            {
                Description = "my initial task 2",
                State = TaskState.Completed
            },
            new Task
            {
                Description = "my initial task 3",
                AssignedPerson = context.People.Single(p => p.Name == "Douglas Adams")
            },
            new Task
            {
                Description = "my initial task 4",
                AssignedPerson = context.People.Single(p => p.Name == "Isaac Asimov"),
                State = TaskState.Completed
            });

        context.SaveChanges();
        return (context);
    }
}

} And I just reference Effort and NMemory in the application. And change the data module to this module in the application. However when I want to switch back to testing with the Mock data at run time I would like to set the data dependent module at run time, so I can easily switch between the two if I have to. So how can I do a dynamic dependency?

Best Regards, Alistair

Perhaps I could do an upgrade to EF7 it has support for InMemory databases with a nuget package and allows configuration of which type to use.

Hi Guys, Love your work again but I am not getting my dynamic web api services resolved in the angular controllers in my project. I have created a app from the templates with angular using module zero.

The task test app from the sample works and I am able to retrieve a response using postman

<a class="postlink" href="http://localhost:6247/api/services/tasksystem/task/getTasks">http://localhost:6247/api/services/task ... k/getTasks</a>

With a json body of

{ "AssignedPersonId":null, "State":null } My interface is

public async Task<GetFlightsOutput> GetFlightsAsync(GetFlightsInput input)

And so my web api should be available at <a class="postlink" href="http://localhost:6634/api/services/app/getFlightsAsync">http://localhost:6634/api/services/app/getFlightsAsync</a>

And I also created an interface on the app service with public GetFlightsOutput GetTest1()

but that is not being found either. the error is { "message": "No HTTP resource was found that matches the request URI 'http://localhost:6634/api/services/app/getTest1'." } i.e (using the camel casing)

I thought I should add an extension to DynamicApiControllerBuilder to see the list of methods just to be sure.

Is this something to do with module zero?

Best Regards, Alistair

Sorry for the delay on this.

When I try a GET on <a class="postlink" href="http://localhost:6634/api/services/app/flight/getTest1">http://localhost:6634/api/services/app/flight/getTest1</a>

I get No HTTP resource was found that matches the request URI 'http://localhost:6634/api/services/app/flight/getTest1'

And the same for my PUT 'http://localhost:6634/api/services/app/flight/GetFlightsAsync'." "message": "No HTTP resource was found that matches the request URI

And the dynamic controller in the WebAPI module is built like this DynamicApiControllerBuilder .ForAll<IApplicationService>(typeof(DailyFlightsApplicationModule).Assembly, "app") .Build(); Best Regards, Alistair

Showing 11 to 20 of 33 entries