本文整理汇总了C#中MembershipEntry.ToFullString方法的典型用法代码示例。如果您正苦于以下问题:C# MembershipEntry.ToFullString方法的具体用法?C# MembershipEntry.ToFullString怎么用?C# MembershipEntry.ToFullString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MembershipEntry
的用法示例。
在下文中一共展示了MembershipEntry.ToFullString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateRow
public Task<bool> UpdateRow(MembershipEntry entry, string etag, TableVersion tableVersion)
{
if (logger.IsVerbose) logger.Verbose("UpdateRow entry = {0}, etag = {1}, table version = {2}", entry.ToFullString(), etag, tableVersion);
bool result = table.Update(entry, etag, tableVersion);
if (result == false)
logger.Info(ErrorCode.MembershipGrainBasedTable3,
"Update of {0}, eTag {1}, table version {2} failed. Table now is {3}",
entry.ToFullString(), etag, tableVersion, table.ReadAll());
return Task.FromResult(result);
}
示例2: InsertRow
public Task<bool> InsertRow(MembershipEntry entry, TableVersion tableVersion)
{
if (logger.IsVerbose) logger.Verbose("InsertRow entry = {0}, table version = {1}", entry.ToFullString(), tableVersion);
bool result = table.Insert(entry, tableVersion);
if (result == false)
logger.Info(ErrorCode.MembershipGrainBasedTable2,
"Insert of {0} and table version {1} failed. Table now is {2}",
entry.ToFullString(), tableVersion, table.ReadAll());
return Task.FromResult(result);
}
示例3: InsertRow
public async Task<bool> InsertRow(MembershipEntry entry, TableVersion tableVersion)
{
try
{
if (logger.IsVerbose) logger.Verbose("InsertRow entry = {0}, table version = {1}", entry.ToFullString(), tableVersion);
var tableEntry = Convert(entry, tableManager.DeploymentId);
var versionEntry = tableManager.CreateTableVersionEntry(tableVersion.Version);
bool result = await tableManager.InsertSiloEntryConditionally(
tableEntry, versionEntry, tableVersion.VersionEtag);
if (result == false)
logger.Warn(ErrorCode.AzureTable_22, String.Format("Insert failed due to contention on the table. Will retry. Entry {0}, table version = {1}", entry.ToFullString(), tableVersion));
return result;
}
catch (Exception exc)
{
logger.Warn(ErrorCode.AzureTable_23, String.Format("Intermediate error inserting entry {0} tableVersion {1} to the table {2}.",
entry.ToFullString(), (tableVersion == null ? "null" : tableVersion.ToString()), tableManager.TableName), exc);
throw;
}
}
示例4: UpdateIAmAlive
public Task UpdateIAmAlive(MembershipEntry entry)
{
if (logger.IsVerbose) logger.Verbose("UpdateIAmAlive entry = {0}", entry.ToFullString());
table.UpdateIAmAlive(entry);
return TaskDone.Done;
}
示例5: UpdateIAmAlive
public async Task UpdateIAmAlive(MembershipEntry entry)
{
try
{
if (logger.IsVerbose) logger.Verbose("Merge entry = {0}", entry.ToFullString());
var siloEntry = ConvertPartial(entry, tableManager.DeploymentId);
await tableManager.MergeTableEntryAsync(siloEntry);
}
catch (Exception exc)
{
logger.Warn(ErrorCode.AzureTable_26, String.Format("Intermediate error updating IAmAlive field for entry {0} to the table {1}.", entry.ToFullString(), tableManager.TableName), exc);
throw;
}
}
示例6: UpdateRow
public async Task<bool> UpdateRow(MembershipEntry entry, string etag, TableVersion tableVersion)
{
try
{
if (logger.IsVerbose) logger.Verbose("UpdateRow entry = {0}, etag = {1}, table version = {2}", entry.ToFullString(), etag, tableVersion);
var siloEntry = Convert(entry, tableManager.DeploymentId);
var versionEntry = tableManager.CreateTableVersionEntry(tableVersion.Version);
bool result = await tableManager.UpdateSiloEntryConditionally(siloEntry, etag, versionEntry, tableVersion.VersionEtag);
if (result == false)
logger.Warn(ErrorCode.AzureTable_24,
$"Update failed due to contention on the table. Will retry. Entry {entry.ToFullString()}, eTag {etag}, table version = {tableVersion} ");
return result;
}
catch (Exception exc)
{
logger.Warn(ErrorCode.AzureTable_25,
$"Intermediate error updating entry {entry.ToFullString()} tableVersion {(tableVersion == null ? "null" : tableVersion.ToString())} to the table {tableManager.TableName}.", exc);
throw;
}
}
示例7: UpdateIAmAlive
public async Task UpdateIAmAlive(MembershipEntry entry)
{
try
{
if (logger.IsVerbose) logger.Verbose("Merge entry = {0}", entry.ToFullString());
var siloEntry = ConvertPartial(entry);
var fields = new Dictionary<string, AttributeValue> { { SiloInstanceRecord.I_AM_ALIVE_TIME_PROPERTY_NAME, new AttributeValue(siloEntry.IAmAliveTime) } };
var expression = $"attribute_exists({SiloInstanceRecord.DEPLOYMENT_ID_PROPERTY_NAME}) AND attribute_exists({SiloInstanceRecord.SILO_IDENTITY_PROPERTY_NAME})";
await storage.UpsertEntryAsync(TABLE_NAME_DEFAULT_VALUE, siloEntry.GetKeys(),fields, expression);
}
catch (Exception exc)
{
logger.Warn(ErrorCode.MembershipBase,
$"Intermediate error updating IAmAlive field for entry {entry.ToFullString()} to the table {TABLE_NAME_DEFAULT_VALUE}.", exc);
throw;
}
}
示例8: UpdateRow
public async Task<bool> UpdateRow(MembershipEntry entry, string etag, TableVersion tableVersion)
{
try
{
if (logger.IsVerbose) logger.Verbose("UpdateRow entry = {0}, etag = {1}", entry.ToFullString(), etag);
var siloEntry = Convert(entry);
int currentEtag = 0;
if (!int.TryParse(etag, out currentEtag))
{
logger.Warn(ErrorCode.MembershipBase,
$"Update failed. Invalid ETag value. Will retry. Entry {entry.ToFullString()}, eTag {etag}");
return false;
}
siloEntry.ETag = currentEtag + 1;
bool result;
try
{
var conditionalValues = new Dictionary<string, AttributeValue> { { CURRENT_ETAG_ALIAS, new AttributeValue { N = etag } } };
var etagConditionalExpression = $"{SiloInstanceRecord.ETAG_PROPERTY_NAME} = {CURRENT_ETAG_ALIAS}";
await storage.UpsertEntryAsync(TABLE_NAME_DEFAULT_VALUE, siloEntry.GetKeys(),
siloEntry.GetFields(), etagConditionalExpression, conditionalValues);
result = true;
}
catch (ConditionalCheckFailedException)
{
result = false;
logger.Warn(ErrorCode.MembershipBase,
$"Update failed due to contention on the table. Will retry. Entry {entry.ToFullString()}, eTag {etag}");
}
return result;
}
catch (Exception exc)
{
logger.Warn(ErrorCode.MembershipBase,
$"Intermediate error updating entry {entry.ToFullString()} to the table {TABLE_NAME_DEFAULT_VALUE}.", exc);
throw;
}
}
示例9: InsertRow
public async Task<bool> InsertRow(MembershipEntry entry, TableVersion tableVersion)
{
try
{
if (logger.IsVerbose) logger.Verbose("InsertRow entry = {0}", entry.ToFullString());
var tableEntry = Convert(entry);
bool result;
try
{
var expression = $"attribute_not_exists({SiloInstanceRecord.DEPLOYMENT_ID_PROPERTY_NAME}) AND attribute_not_exists({SiloInstanceRecord.SILO_IDENTITY_PROPERTY_NAME})";
await storage.PutEntryAsync(TABLE_NAME_DEFAULT_VALUE, tableEntry.GetFields(true), expression);
result = true;
}
catch (ConditionalCheckFailedException)
{
result = false;
logger.Warn(ErrorCode.MembershipBase,
$"Insert failed due to contention on the table. Will retry. Entry {entry.ToFullString()}");
}
return result;
}
catch (Exception exc)
{
logger.Warn(ErrorCode.MembershipBase,
$"Intermediate error inserting entry {entry.ToFullString()} to the table {TABLE_NAME_DEFAULT_VALUE}.", exc);
throw;
}
}