Open PromontoryProtean opened 8 years ago
Can you share your project.json
file?
Sure thing. I assume you mean for the website project?
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Session": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Binder": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-rc2-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Antaris.AspNetCore.Mvc.Widgets": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
@Antaris I'm definitely not in a rush or anything but I figured I'd check back in case you missed the post with my file. I've noticed that notifications sometimes don't go out when posts occur in rapid succession.
@PromontoryProtean Sorry pal I've been away for the last week, will try and jump on this again this week
Ok no problem, thanks for the heads up. Again, no rush, I figured you might have been away or something like that.
@Antaris I've been checking this out and ran into an issue. I can get a widget to load via InvokeGet without a problem, but when I do a postback I am getting the following error:
MissingMethodException: No parameterless constructor defined for this object.
I followed your sample pretty closely so I'm not sure what is causing it to bug out. I'll give you code examples, but I'd also like to describe my scenario first to see if you think it is conceptually viable.
I have a system that generates a collection of page widgets (not to be confused with what you call widgets) based on a requested URL. Each page widget has a number of properties/settings that are used to initialize the page widget. For example, if it is a contact form, one of the properties might be the subject line of an email that gets relayed to an administrator. So say I have a page widget collection that the controller pulls from a database such as:
IEnumerable<PageWidget> PageWidgets
Now, in the view, I am trying to load each corresponding widget dynamically and send the page widget's properties to the widget:
My get works:
But my post generates the error I described above:
I know you said "Arguments provided at invocation are used over model binder-sourced arguments", so I'm not sure my scenario would work regardless of the error. But even if I change the post signature to the following I get the same error:
public async Task<IWidgetResult> InvokePostAsync(ContactFormViewModel model)
Most of this is hard to explain so I'm not sure if I did a good job. Curious to get your thoughts here. Hopefully what I described makes some sense.