Base solution for your next web application

Activities of "acrigney"

I had a lot of issues trying to get a project running with the latest Angular 1 template. Could you upgrade the sample apps like the SimpleTask app to use the latest nugets please? Also I wasn't clear about the latest breaking changes, could this go in the wiki?

Best Regards, Alistair

Great to see you are getting into ASP.NET Core but the migration is looking for a .dll however I see that a (Project.EntityFrameworkCore.exe is being created instead? Here is the output from the Package Manager Console \Projects\Products\src\TrueAlliance.Products.Web\Views\Shared\Components\LanguageSelection\LanguageSelectionViewComponent.cs(19,49): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. Could not find assembly '.\bin\src\TrueAlliance.Products.Web\bin\Debug\net461\win7-x86\TrueAlliance.Products.EntityFrameworkCore.dll'.

PM> Add-Migration "Initial" Could not find assembly '.\bin\src\TrueAlliance.Products.Web\bin\Debug\net461\win7-x86\TrueAlliance.Products.EntityFrameworkCore.dll'.

C:\Projects\Products\test\TrueAlliance.Products.Web.Tests\ProductsWebTestBase.cs(53,34): warning CS0114: 'ProductsWebTestBase.GetUrl<TController>(string)' hides inherited member 'AbpAspNetCoreIntegratedTestBase<Startup>.GetUrl<TController>(string)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. 6>C:\Projects\Products\test\TrueAlliance.Products.Web.Tests\ProductsWebTestBase.cs(58,34): warning CS0114: 'ProductsWebTestBase.GetUrl<TController>(string, object)' hides inherited member 'AbpAspNetCoreIntegratedTestBase<Startup>.GetUrl<TController>(string, object)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. 6> Compilation succeeded.>C:\Projects\Products\test\TrueAlliance.Products.Web.Tests\ProductsWebTestBase.cs(53,34): warning CS0114: 'ProductsWebTestBase.GetUrl<TController>(string)' hides inherited member 'AbpAspNetCoreIntegratedTestBase<Startup>.GetUrl<TController>(string)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. 6>C:\Projects\Products\test\TrueAlliance.Products.Web.Tests\ProductsWebTestBase.cs(58,34): warning CS0114: 'ProductsWebTestBase.GetUrl<TController>(string, object)' hides inherited member 'AbpAspNetCoreIntegratedTestBase<Startup>.GetUrl<TController>(string, object)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. 6> Compilation succeeded.

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

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

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, 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

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!!

Am getting a strange issue of duplicates of my child objects getting created when I add references to these child objects in a collection. i.e When I add mobile applications to my endUser.MobileApplications I am seeing copies of my MobileApplications being created in the database. As I am only loading the MobileApplication it should not create a copy??

public async Task<long> PostNewEndUserAsync(AddEndUserInput input) { try { Logger.Debug("Adding a new end InviteUser async: " + input.Surname);

            EndUser newEndUser = Mapper.Map&lt;EndUser&gt;(input);

            newEndUser.EndUserSecurityQuestionCode = -1;
            newEndUser.AcceptedTermsAndConditions = input.AcceptedTermsAndConditions;

            if (input.MobileApplications == null)
            {
                // Add the mobile app

                if (String.IsNullOrEmpty(input.ApplicationName))
                {
                    // if none is specified use the DefaultRegistrationApplicationName 
                    input.ApplicationName = ConfigurationFacade.DefaultRegistrationApplicationName;
                }
                List&lt;MobileApplication&gt; mobileApplications = _mobileApplicationRepository.GetAllList(x => x.Name == input.ApplicationName);

                MobileApplication mobileApplication = mobileApplications.FirstOrDefault();

                if (mobileApplication == null)
                {
                    throw new Exception(String.Format("Mobile application {0} was not found to register the end user for.", input.ApplicationName));
                }

                newEndUser.MobileApplications.Add(_mobileApplicationRepository.Load(mobileApplication.Id));
            }
            else
            {
               **foreach (MobileApplicationDto mobileApplication in input.MobileApplications)
                {
                    newEndUser.MobileApplications.Add(_mobileApplicationRepository.Load(mobileApplication.Id));
                }**
            }
            long id = await _endUserRepository.InsertAndGetIdAsync(newEndUser);
            return (id);
        }
        catch (Exception ex)
        {
            string msg = ex.GetBaseException().Message;
            UserFriendlyException userFriendlyException = new UserFriendlyException(msg);
            throw userFriendlyException;
        }            
    }

Hi Guys, I have had no problems at all so far and love the framework, totally awesome design and the doco is great as well!! Just I added some unrelated code changes and now my dynamic web apis are timing out. I am completely stumped. The application service layers are just not being called from the dynamic web api. I am using Durandal and EF if that helps, I think Durandal is way better than angular for performance with large web apps.

My database connections and data are all ok.

Any help at all would be totally awesome!

Best Regards, Alistair

Showing 1 to 10 of 13 entries