Can't get Azure TableEntity etag on CreateQuery -
i'm doing query entities table, changing them, doing replace operation. replace operation fails because etag property on etag null. checked, , etag null when entity createquery() call, populated when retrieve(). there way etag manually?
ienumerable<myentity> query = e in servicecontext.createquery<myentity>(tablename) e.id == queryid select e; myentity entity = query.firstordefault(); // update myentity object var replaceoperation = tableoperation.replace(entity); mycloudtableclient.gettablereference(tablename).execute(replaceoperation); // exception thrown here etag value null
the problem stems fact mixing 2 different components.
servicecontext.createquery<myentity>(tablename)
is using system.data.services.client namespace. in model entity not track etag, context you.
mycloudtableclient.gettablereference(tablename).execute(replaceoperation)
is using table.dataservices namespace. in model there no central context , each entity tracks own state exposing etag property. enforced via itableentity interface. entity using query not intended used newer libraries, , root of problem.
switch using
mycloudtableclient.gettablereference(tablename).createquery<myentity>()
to create query , issues should go away.
Comments
Post a Comment