There is a database 1C. It is provided with RESTful access via the OData protocol. I am writing a client in C #. Connect to this service through the "Add a link to the service."

The data request goes bang through DataServiceContext (created automatically). I am trying to add a client to the "Catalog_Partner" table.

var context = new CRM_2Demo.EnterpriseV8(odataUri) { Credentials = odataCredentials }; var newClient = new CRM_2Demo.Catalog_Партнеры { CRM_Имя = "Влад" }; context.AddToCatalog_Партнеры(newClient); DataServiceResponse response = context.SaveChanges(); 

An entry to the database is added, however the "CRM_Name" field is still empty. Why?

PS I have a suspicion that this is due to the fact that classes have Cyrillic names, but Visual Studio generated all the classes to work with the service without problems ... I also tried to initialize other fields but they all remain empty.

    1 answer 1

    See Linq to ODATA

    Look at what is sent. Perhaps Ref_Key needs to be assigned. And try to update the record https://msdn.microsoft.com/ru-ru/library/dd756361(v=vs.100).aspx

    And all fields must be filled. Get one entry and see which fields are filled.

    • Updating, deleting and creating empty records is successful. I looked at Wireshark, he can not disassemble the Russian text and instead of it the dots are ".....". Now I’ll take a look at Fiddler - cvvvlad
    • In Fiddler, you can see that the request is sent correctly (<d: CRM_Name> Test </ d: CRM_Name>), and the result is returned with an empty CRM_Name field ... - cvvvlad
    • When a new GUID 'newClient.RefKey = Guid.NewGuid ()' is assigned to the client, it is assigned a new guid and the response also contains the same guid. - cvvvlad
    • And try using the JSON context.Format.UseJson () ;. I did not use for recording. - Serginio
    • Ask a question here forum.mista.ru/index.php , just do not mention Linq. Give the Fiddler data - Serginio