Deserialize meta $id to ID property - json.net

The JSON.NET deserializer recognizes a property named $id, and internally uses this property's value to identify the object. The server-side of my app populates these properties with unique values that are meaningful to the app. The POCOs on my app's client all have string ID properties.
How do I configure JSON.NET such that, upon deserialization, the $id values will be stored in the POCOs' string ID properties?

Related

how can I transfer the string value of a variable in Azure Cosmos DB using the Bot Framework Composer V2?

To enter data into the Cosmos DB Tables, I use this addition (https://github.com/tomlm/iciclecreek.bot/tree/master/source/Libraries/Iciclecreek.Bot.Builder.Dialogs.Database.AzureStorage). The problem is that I cannot pass the value of the variable to the entity. Only the name of the variable is passed, not its content. My variable only contains a string value and is outputted for validation without any problem.
In this add-on, I use the Entity Operation block.
//Content Entity
// ${dialog.cosmos.name} - my variable whose value needs to be passed
{
"partitionKey": "KeyP2",
"rowKey": "RowKeyR1",
"nameUs": "${dialog.cosmos.name}",
"surnameus": "feleni"
}
You need to set a property with all variables before the entity operation block. And then insert this property into the Entity.
https://i.stack.imgur.com/xqo75.png

Update existing entity property values with array properties

I am using Google Cloud Datastore in my project, and have thousands of entities already. I want to update existing values of a property (which is of type String) to Array Values. Basically i want that property to now hold 2 values - existing value and corresponding new value for all entities. Can we do that? I want to avoid a new kind which has mapping of existing to new one.
ex - From id to id
10 10 20
Also i don't see Array Value API support in Entity class in GAE SDK 1.9.30. Is it added in 1.9.36?

Storing custom Type in SQLite .NET field

We are using SQLite.Net in a C# application and I want to define a property on one of the classes that gets stored on the db as having a custom type.
The type is essentially an Enum and a string, can be serialised to a string representation and I have overridden ToString
What is the correct way of getting this type in and out of a Field?
Thanks

Access model object in property editor in Spring MVC

I have a Map of two custom objects as property in my Model object that I display in JSP by directly binding it in path and items attribute of <form:select>
<form:select id="selectedpbrtypes" multiple="true" items="${prescriber.selectedpbrtypes}" path="selectedpbrtypes"/>
On submission I get a comma separated string of all selected values of <form:options>.
Now the issue that I want to access separate property of Model object
private Map<Integer, PrescriberTypeModel> availablePbrTypes
And use availablePbrTypes to fetch all PrescriberTypeModel based on values in comma separated string in setAsText method of property editor and create a Map.
Please help as I have no idea how to access some other object in property editor.

GAE Datastore - workaround for updating entity?

Assume:
class Contacts(db.Model):
first_name = StringProperty()
last_name = StringProperty()
phone_number = PhoneNumberProperty()
new_contact = Contacts(first_name="Homer", last_name="Simpson", phone_number = 1234566)
new_contact.put()
I am new to GAE Datastore, but per GAE Datastore Docs (see below if interested), i can't modify a single property of the entity (eg, phone_number). I have to re-declare all properties, and then put() the new entity. Omitting previously-declared properties from the new entity results in them being declared as None. Is there a workaround for this -- such as manually overriding the key-name generation function -- so the entity maintains the same key?
#
from GAE Datastore Docs:
To update an existing entity, modify the attributes of the object, then call the put() method. The object data overwrites the existing entity. The entire object is sent to the datastore with every call to put(). Note: The datastore API does not distinguish between creating a new entity and updating an existing entity. If the object's key represents an entity that exists, calling its put() method overwrites the entity.
that's not true. You need to have a way to get the contact you want and you can update just that. Using the keyname is only one way to do it. If you know the ID of filter a query to only get one entity, you can update a field from it and the put() to update it.
You could have something like:
query = Contact.all().filter('first_name', 'john').filter('last_name', 'doe')
for contact in query:
contact.phone_number = 498340594834
contact.put()
Note that that code would update any contacts with that name to that phone number. If there is more than one with that name, both are updated. Using a keyname can prevent that but you have to create more complex keys since only the first and last name might colide.

Resources