Skip to content

Can we set a toJSON function to entities without effecting the way breeze js works? #197

@ofirgeller

Description

@ofirgeller

If so, will this remain try in future versions?

The reason to do this is that when using redux it's much better if the state can be serialized, even if it's only a one way serialization. as it allows to inspect the state using tools like 'redux-devtools'. this however can only work if entities can be stringified, and as-is they can't be, my solution is to config the entity ctor like this

     this.metadataStore.registerEntityTypeCtor('MyEntityType', function () {
            this.toJSON = function () {
                return this._backingStore;
            };
        });

One can make this better to see more info like parts of the entity aspect, but this is the basic idea.

I would like to know if this will cause some hard to detect bugs inside of breeze or if it will break in future updates you are already planning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions