Database Push Method (Editing record MS SQL)
Database Push Method (Editing record MS SQL)
georgemcfly
Posts: 18Questions: 4Answers: 0
in Bug reports
When working with a table in SQL Azure, the Geometry and Geography datatypes are causing DataReader.GetFieldTypes errors. Looking at this method, I would also think it would be more performant to use the set collection to name the fields that are being updated? (Maybe you have this for Inserts). Either way I am unable to edit tables with this datatypes. Add and delete work fine.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi,
Is this using Editor's .NET libraries or are you using something else on the server-side?
Allan
Editor's .NET Libraries
Thanks! Are you using a model for this? The model currently needs to contain types which are directly representable in JSON - e.g.
string
,int
, etc. More complex types can't be represented in JSON.Perhaps you can show me some of the code you are using?
Thanks,
Allan
The model is basic, there are two fields on the underlying table that have datatypes of geography and geometry that is causing the problems. Here is the model
public class AddressModelDT
{
and the code that executes it
Thanks!
Super - thanks!
I was able to reproduce this locally as well simply by using a Geography data type in the db and making a "string" in the model.
This thread helped to resolve it locally for me. This one is also relevant.
Could you clarify what you mean by that?
Thanks,
Allan
Thanks Allan
Oh on the last part, I very really do Select * from a database table because it in the past has always played a heavier load on the DB and returns more data than I need. Not sure if that is still the case with current providers.
Well I clicked the answer too quickly. It is still happening. I'll investigate a little deeper but the API layer is in an Azure App Service and I used the Cloud Explorer to verify the Microsoft.SqlServer.Types.dll is in the bin.
I don't think Editor does a SELECT * anywhere - it should always list the fields that it wants to get from the db. Is that not the case for you?
Thanks,
Allan
I see it in the Push method of the Database class.
Just curious to hear the final word on this?
Yes I see what you mean. Perhaps it would be more performant to get on of the column names from the
set
object and use that rather than*
. Is that what you were referring to in your other thread?Allan
yes and based on my experience, it usually is. It seems safer for scenarios where you have funky datatypes or computed columns. Thanks!
Is this something that you will fix (it causes problems when editing records with unsupported datatypes in MS SQL) ? Its causing a problem in our application and I don't like modifying 3rd party libraries unless we have to.
Thanks
Yes, I think picking a column name out of the set object would be the right thing to do here. Ideally the column would be indexed, but without making the function a lot more complicated, that wouldn't be easy to do.
I've got this logged as something to be included in Editor 1.8.
Allan
Awesome, thank you.