Questions tagged [custom-model-binder]

The custom binding class needs to inherit form IModelBinder. Here we capture the current request and extract the Form fields individually. Then we can manipulate these fields any way we like.

Useful links

176 questions
0
votes
1 answer

Issue with Html.EditorFor on MVC3

I have a view with a form that's is typed to a viewmodel called AddEditItemVM. This viewmodel has the following property: public List Categories{get;set;} What im trying is two things: Render a checkbox foreach Category in the generic…
Jose3d
  • 9,149
  • 6
  • 33
  • 54
0
votes
1 answer

How to get rid of the error "Fatal signal 11 (SIGSEGV), code 1, fault addr 0x70"

I was doing my android project. Basically the user enters a text and the model predicts whether it is offensive or not. This was done by training a deep learning model LSTM on python. Then I deployed it to the cloud (Firebase). And downloaded it in…
0
votes
2 answers

Custom model building for EF Core

I have a model that I want to load one of its columns from a source other than the database behind EF Core for example MongoDb. The problem is that I can't figure how to override query execution in EF Core. For Saves it's OK because EF Core lets us…
0
votes
1 answer

asp.net core 3.0 IModelBinder

IModelBinder does not get recognized and compile with only asp.net core 3.0 (netcoreapp3.0) installed untill Microsoft.AspNetCore.Mvc.2.2.0 nuget is installed and the version 3.0 nuget is not available for the same. Is it fine to include 2.2.0 nuget…
Satyajit
  • 1,971
  • 5
  • 28
  • 51
0
votes
1 answer

How to disable model binding for one action method in asp.net mvc

We are using custom model binders, how to disable model binding for one action method, so that i can directly post data from angular http post request, I have taken different/new class as parameter for action method. but due to custom model binders…
0
votes
2 answers

Attribute Routing Values into Model/FromBody Parameter in ASP.NET CORE

I'm working on a .NET core web API application, where I want the URL routing values into Model/FromBody parameter. If the routing property is exist in From body model. Is there any generic solution for this, i.e will work for all model types. We…
0
votes
1 answer

How to bind a model to a session in ASP MVC Core

I bind the model to a session in ASP MVC Framework like this: public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { Cart cart = null; …
Ivan
  • 1,081
  • 2
  • 17
  • 43
0
votes
1 answer

Implement IModelBinder for string collection

Actually on my .NET Core project i'm using a simple modelbinder to trim input string public class StringModelBinder : IModelBinder { public Task BindModelAsync(ModelBindingContext bindingContext) { if (bindingContext == null) …
Sauron
  • 2,156
  • 5
  • 17
  • 20
0
votes
1 answer

how to read un-named object from BindingContext

I need to implement Custom model binding and so trying to implement IModelBinder for .Net Core 2.1 API application. Model class - [ModelBinder(BinderType = typeof(PersonBinder))] public class Person { public name {get;set;} public…
user979189
  • 1,230
  • 2
  • 15
  • 39
0
votes
1 answer

How to use DefaultModelBindingMessageProvider in ModelBinders

We have a custom DateTimeModelBinder that used to work fine with ASP.NET Core 1.1, but after upgrading to 2.2, it fails. This is the breaking part: bindingContext.ModelState.TryAddModelError( …
galmok
  • 869
  • 10
  • 21
0
votes
1 answer

Custom Model training opennlp

Hi already have referred to this, this, this and this but still finding it difficult to build a custom name finder model.. Here is the code: public class CustomClassifierTrainer { private static final TokenNameFinderFactory…
Shery
  • 1,808
  • 5
  • 27
  • 51
0
votes
1 answer

ASP .NET Web API ModelBinder single parameter

Currently I've got this ModelBinder that works just fine: public class FooModelBinder : IModelBinder { public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { var body =…
Marcelo
  • 784
  • 3
  • 9
  • 30
0
votes
0 answers

How to apply multiple optional filters in a LINQ query

I have a page where user can select any number of search filters to apply search When user clicks on search, these parameters are passed to my GetIndicatorData method to perform the query. However, it doesn't seem to work for me. Here is my…
0
votes
1 answer

Custom ASP.Net Core JSON model binder

My posted JSON object is this: {{ "emails": [ { "To": "info@gmail.com", "Subject": "Subject", "Body": "Body", "ID": "d3d13242-6eff-4c57-b718-ef5ad49fe301" }, { "To":…
MRP
  • 499
  • 5
  • 24
0
votes
1 answer

Web-Api Route resolution Array Model Binding

I'm trying to understand how Web-Api Resolves Routes. I have two routes which use the same base path [WriteRoute(DivisionAPIRoutes.PAYROLL_IMPORT_PTO)] [HttpPost] public void ImportPTOByIds(GlobalEntityKey parentId,…
johnny 5
  • 19,893
  • 50
  • 121
  • 195