To query an XDocument, use doc.Descendants(“{node name}”). This returns all nodes with the given name, regardless of their position in the hierarchy.
The code often has to convert from X{something} to a primitive.

Entity Framework has its own SQL: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/ef/language-reference/select-entity-sql.
Especially pay attention to the “select value” statement. Also, a “select *” is forbidden in ESQL.

Json serialization:
– when class hasn’t been decorated with DataContract, all public properties and fields are serialized by default; to exclude a field or a property, decorate it with JsonIgnore
– when class has been decorated with DataContract, only members decorated with [DataMember] are serialized (private members decorated with DataMember are serialized as well)

Xml serialization:
– DataContractSerializer is used by default
– decorate a class with [DataContract] to control the serialized name and namespace; once decorated, decorate the members that should be serialized (properties and fields, regardless of access) with [DataMember]; specify a Name value for the DataMember to control this aspect.

– when the output must match a given xml schema, use XmlSerializer, which allows for tighter control over the generated xml

Advertisements