Giter VIP home page Giter VIP logo

Comments (3)

Roblinde avatar Roblinde commented on June 15, 2024 1

No, I missed it in the docs πŸ˜„

from contentful.net.

Roblinde avatar Roblinde commented on June 15, 2024

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.

deanebarker avatar deanebarker commented on June 15, 2024

Did I miss this in the doc?

from contentful.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.