Base solution for your next web application

Activities of "acrigney"

I made another post on this topic but it hasn't been approved yet, lets wait for that.

Best Regards, Alistair

I posted before about trying to use the dynamic web api controllers with WPF/Xamarin but I don't think I got a response yet.

I thought that I could host my webapi module in an Owin self hosting console project.

So the console program depends on my web api module

[DependsOn(typeof(ReadyCareWebApiModule))] class Program { static void Main(string[] args) { } } I came up with this so far for the statup mehod.

using Abp; using Abp.Modules; using Abp.WebApi.Configuration; // Add the following usings: using Owin; using System.Web.Http;

namespace ReadyCare.Owin.WebApi.Host { public class Startup : AbpModule { // This method is required by Katana: public void Configuration(IAppBuilder app) { AbpBootstrapper bootstrapper = new AbpBootstrapper();

        bootstrapper.Initialize();

        WindsorDependencyResolver windsorDependencyResolver = new WindsorDependencyResolver();
        windsorDependencyResolver.IocManager = this.IocManager;

        var httpConfiguration = IocManager.Resolve<IAbpWebApiModuleConfiguration>().HttpConfiguration;

        httpConfiguration.DependencyResolver = windsorDependencyResolver;

        // Use the extension method provided by the WebApi.Owin library:
        app.UseWebApi(httpConfiguration);
    }
}

}

Where the The WindsorDependencyResolver will be SOMETHING like this, based on another post you made?

public class WindsorDependencyResolver : IDependencyResolver { public IIocManager IocManager { get; set; } public override object GetService(Type serviceType) { return IocManager.IocContainer.Kernel.HasComponent(serviceType) ? IocManager.IocContainer.Resolve(serviceType) : base.GetService(serviceType); }

    public override IEnumerable<object> GetServices(Type serviceType)
    {
        return IocManager.IocContainer.Kernel.HasComponent(serviceType) ? IocManager.IocContainer.ResolveAll(serviceType).Cast<object>() : base.GetServices(serviceType);
    }
}

Maybe I need some more support, happy to discuss options. Best Regards, Alistair

Question

Hi Guys, Love your work, I have been building DDD frameworks myself but you've done a really great job! My client needs to use WebAPI for WPF/Xamarin apps. So I wanted to use your DynamicApiControllerBuilder to create these services from the applications and then to just resolve them in c# code on the client WPF/Xamarin side.

So I need the WPF module to dependon the ReadyCareWebApiModule [DependsOn(typeof(ReadyCareDataModule), typeof(ReadyCareApplicationModule), typeof(ReadyCareWebApiModule))] public class ReadyCareWpfModule : AbpModule

Then it looks like I can use the AbpHttpControllerSelector. SelectController mehod to get the controller i.e This method public override HttpControllerDescriptor SelectController(HttpRequestMessage request)

Then I can use the ExecuteAsync on the HttpControllerDescriptor to execute an action on the controller?

Of course we would do appropriate caching as required.

Alternatively should I write the webapi methods by hand and just call the application methods in there, but thats what we don't want to have to do right.

Best Regards, Alistair

Showing 31 to 33 of 33 entries