Is it possible to disable Editor's create method in .NET library?
Is it possible to disable Editor's create method in .NET library?
kevan.watkins
Posts: 22Questions: 5Answers: 0
in Editor
I have one case where I wish to create the new database entry externally in WriteCreate event.
I do not wish Editor .NET library to attempt to create a row.
So I tried adding .Set(false) to all fields, but this produces the error: "Object reference not set to an instance of an object."
Kind regards,
Kevan
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi Kevan,
There isn't a global option to disable one of the actions (create, edit or remove), but what you could do to give that effect is use a global validator. That gives you the action, so you could just reject all create actions as invalid.
Allan
Okay, but wouldn't rejecting the create action in a global validator stop the writeCreate event from firing and cause the client to display an error and remain on the edit page?
Is there any chance of fixing the .Net create action to do nothing if no fields are to be set instead of throwing "Object reference not set to an instance of an object." exception?
I do have another not so nice workaround, so can live without..
Thanks for the time.
Yes, that is something I think should be fixed. Thanks for noting that. I'll have it in the next release of Editor.
Allan
Fantastic! Thank you Allan
Just a quick one to say that the issue with the error being thrown when there are no settable fields has been resolved and will be included in the 1.6.4 release which will drop shortly.
Allan
Thanks, Allan.
I finally got to testing this.
Having no settable fields no longer thrown an error, but WriteCreate is not called.
WriteEdit is called when no fields are settable, but WriteCreate, it seems, is not.
hi,
Good point - there is indeed a bit of a discrepancy there. I suspect that not calling either is the correct thing to do here since nothing has been written to the table, but that might not be suitable for your use case?
Allan