Comments (3)
No, I missed it in the docs π
from contentful.net.
We actually do have this. Whether or not you like the implementation is another question π
What you can do is decorate any method with an [OnDeserialized] attribute and that method will be called as part of the deserialization.
You have these hooks:
[OnSerializing]
[OnSerialized]
[OnDeserializing]
[OnDeserialized]
The methods decorated can optionally take a StreamingContext which is rarely useful, but there for conformity with the rest of the serialization APIs.
So you could have:
public class Term {
//Your general awesomeness
[OnDeserialized]
internal void DoSomeTransformationsAndResolutionsAndWhatNot(StreaminContext context) {
//Do what you gotta do!
}
}
That said I think the idea of having global events exposed by the ContentfulClient class is definitely interesting and could allow for some nice extension points. I'll add that to my todo, once I've figured out what those events should be π
The base class idea is also interesting, but I would like to make as few assumptions about the consuming code as possible, and it'd be easy for me to start assuming (or even requiring) all of your POCOs to inherit from the base. I'd like to avoid that as much as possible, but we'll see...
Let me know what you think of this.
from contentful.net.
Did I miss this in the doc?
from contentful.net.
Related Issues (20)
- Assets are not resolved selectively HOT 10
- Unable to save Rich Text field with BlockData HOT 4
- VerisonMismatch HOT 4
- Quality parameter is discarded for webp images in ImageUrlBuilder HOT 2
- Support ETag in SDK for improved caching HOT 10
- Support Environments HOT 1
- QueryBuilder is hostile to re-use HOT 2
- GetEntriesForLocale() always throws βThe resource could not be found.β
- Newtonsoft 13 - Maxdepth error HOT 1
- [v7.1.0] Serialization Error when using a reference in an Entity HOT 3
- Support quality parameter via ImageTagHelper for webp format HOT 4
- Sync API and UsePreviewApi HOT 4
- Call to GetEntriesRaw not resolving linked entries like JavaScript Sdk HOT 4
- Deserializing response that references same content twice in to different objects throws System.ArgumentException: The value "Type" is not of "Expected type" HOT 4
- Assets returning null for some entries but not others, even when published. HOT 2
- Issue with deserialization with sub/superscript is enabled for RichText HOT 2
- Is there a way to setup a default IContentTypeResolver? HOT 2
- ContentfulClient GetEntries not resolving entries sub props objects correctly in certain scenario HOT 4
- MinHeight missing public accessor HOT 1
- System.ArgumentException: Requested value 'superscript' was not found.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contentful.net.