New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline Sync records CreatedAt is null until PushAsync is called and if set directly, is overwritten with the Sync time. #74

Closed
renzska opened this Issue Feb 3, 2016 · 3 comments

Comments

Projects
None yet
5 participants
@renzska

renzska commented Feb 3, 2016

In our code, we display records with the date they were created. We are using the CreatedAt field to do this. When switching over to use offline sync, a new local record does not have the CreatedAt field populated until after a PushAsync is called. To address this issue we are setting the CreatedAt value to DateTime.Now; so we have a value in the local DB before the push. In our testing, however, the CreatedAt date is overwritten with the time the sync occurs.

Is it fair to say that the CreatedAt should not be used in this manner? If we want to store the date the user created the record, we would need to store it in our own field? I'm guessing this is the case. It would be good to have this documented somewhere.

@apoorvg

This comment has been minimized.

Show comment
Hide comment
@apoorvg

apoorvg Feb 12, 2016

We have observed the same behavior and are using our own field to store the record creation time. CreatedAt / UpdatedAt are always updated / overridden post Push.

apoorvg commented Feb 12, 2016

We have observed the same behavior and are using our own field to store the record creation time. CreatedAt / UpdatedAt are always updated / overridden post Push.

@nadjibus

This comment has been minimized.

Show comment
Hide comment
@nadjibus

nadjibus Mar 16, 2016

+1, could be helpful if we can save CreatedAt to local table, then let the server overrides it when we Sync (to avoid malicious things/invalid device Date/Time)

+1, could be helpful if we can save CreatedAt to local table, then let the server overrides it when we Sync (to avoid malicious things/invalid device Date/Time)

@lindydonna

This comment has been minimized.

Show comment
Hide comment
@lindydonna

lindydonna May 4, 2016

@renzska CreatedAt cannot be used in this way. If you need the value of the local created at, you will need to create a new field. You can create it only locally, if you use the JsonIgnore attribute.

@renzska CreatedAt cannot be used in this way. If you need the value of the local created at, you will need to create a new field. You can create it only locally, if you use the JsonIgnore attribute.

@lindydonna lindydonna closed this May 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment