Skip to content
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

EnablePropertyChangedTrack features doc #83

Open
Ahoo-Wang opened this issue Jul 29, 2019 · 0 comments
Open

EnablePropertyChangedTrack features doc #83

Ahoo-Wang opened this issue Jul 29, 2019 · 0 comments

Comments

@Ahoo-Wang
Copy link
Member

Ahoo-Wang commented Jul 29, 2019

            var entity = SqlMapper.QuerySingle<AllPrimitive>(new RequestContext
            {
                EnablePropertyChangedTrack = true,
                RealSql = "SELECT Top (1) T.* From T_AllPrimitive T With(NoLock)"
            });
            var entityProxy = entity as IEntityPropertyChangedTrackProxy;
            Assert.NotNull(entityProxy);

            var state = entityProxy.GetPropertyVersion(nameof(AllPrimitive.String));
            Assert.Equal(0, state);
            entity.String = "Updated";
            state = entityProxy.GetPropertyVersion(nameof(AllPrimitive.String));
            Assert.Equal(1, state);

            SqlMapper.Update(entity);
Update T_AllPrimitive Set [String]=@String Where [Id]=@Id
Parameters:[String=Updated,Id=169381]
Sql with parameter value: 
Update T_AllPrimitive Set [String]='Updated' Where [Id]=169381

-> https://github.com/Smart-Kit/SmartSql-Docs

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

No branches or pull requests

1 participant